program group(input,output);
var
a:array[1..30000] of integer;
w,n,i,j,s:integer;
procedure qsort(l,r:integer);
var x,i,j:integer;
begin
i:=l; j:=r; x:=a[i];
repeat
while (a[j]>x) and (j>i) do j:=j-1;
if j>i then begin a[i]:=a[j]; i:=i+1; end;
while (a[i]<x) and (i<j) do i:=i+1;
if i<j then begin a[j]:=a[i]; j:=j-1; end;
until i=j;
a[i]:=x; i:=i+1; j:=j-1;
if i<r then qsort(i,r);
if j>l then qsort(l,j);
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]);
qsort(1,n); i:=1; j:=n; s:=0;
while i<=j do begin
if i=j then begin
s:=s+1; break; end;
if a[i]+a[j]<=w then begin
i:=i+1; j:=j-1; s:=s+1; end;
if a[i]+a[j]>w then begin
s:=s+1; j:=j-1; end;
end;
writeln(s);
close(input);close(output);
end.