program zht;
var
i,w,s,z,x,temp,t:longint;
a:array[1..30000] of longint;
procedure qsort(s,t:longint);
var
i,j,x:longint;
begin
i:=s;j:=t;x:=a[(i+j)div 2];
repeat
while a[i]<x do inc(i);
while a[j]>x do dec(j);
if i<=j then
begin
temp:=a[i];a[i]:=a[j];a[j]:=temp;
inc(i);dec(j);
end;
until i>j;
if s<j then qsort(s,j);
if i<t then qsort(i,t);
end;
begin
assign(input,'kaj.in');
assign(output,'kaj.out');
reset(input);
rewrite(output);
readln(s);
readln(w);
for i:=1 to w do
readln(a[i]);
qsort(1,w);
z:=1;
x:=w;
while z<x do
begin
if a[z]+a[x]<=s then begin z:=z+1;x:=x-1;t:=t+1;end
else begin x:=x-1;t:=t+1;end;
end;
if z=x then t:=t+1;
writeln(t);
close(input);
close(output);
end.