import java.util.Arrays;
import java.util.Scanner;
public class jinianpinfenzu {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int [] num = new int [n+1];
for (int i = 1; i < num.length; i++) {
num[i]=sc.nextInt();
}
Arrays.sort(num);
int count = 0;
for (int i = 1,j=num.length-1; i<=j;) {
if(i==j){
count++;
break;
}
if(j-i==1){
count++;
break;
}
if(num[i]+num[j]<=w){
count++;
i++;
j--;
}
else{
j--;
count++;
}
}
System.out.println(count);
}
}