program group(input,output);
var
i,j,k,ans,w,n:longint;
a:array [1..300000] of longint;
procedure sort(i,j:longint);
var
x,temp:longint;
head,tail:longint;
begin
head:=i;
tail:=j;
x:=a[(head+tail) div 2];
repeat
while x>a[head] do inc(head);
while x<a[tail] do dec(tail);
if head<=tail then
begin
temp:=a[head];
a[head]:=a[tail];
a[tail]:=temp;
inc(head);
dec(tail);
end;
until head>tail;
if (head<j) then sort(head,j);
if (i<tail) then sort(i,tail);
end;
begin
assign(input,'group.in');
assign(output,'group.out');
reset(input);
rewrite(output);
readln(w);
readln(n);
for i:=1 to n do readln(a[i]);
sort(1,n);
i:=1;
j:=n;
ans:=0;
while i<=j do begin
if i=j then
begin
ans:=ans+1;
break;
end;
if a[i]+a[j]<=w then
begin
i:=i+1;
dec(j);
inc(ans);
end;
if a[i]+a[j]>w then begin
ans:=ans+1;
j:=j-1;
end;
end;
writeln(ans);
close(input);
close(output);
end.