program group;
var
n,w,m:longint;
x:array[1..30000] of longint;
procedure init;
var
i:longint;
begin
assign(input,'group.in');
reset(input);
assign(output,'group.out');
rewrite(output);
m:=0;
fillchar(x,sizeof(x),0);
readln(w);
readln(n);
for i:=1 to n do readln(x[i]);
end;
procedure qsort(s,t:longint);
var
i,j,y,temp:longint;
begin
i:=s;j:=t;y:=x[(i+j)div 2];
repeat
while x[i]<y do inc(i);
while x[j]>y do dec(j);
if i<=j then
begin
temp:=x[i];x[i]:=x[j];x[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;
procedure main;
var
i,j:longint;
begin
i:=1;
j:=n;
while i<=j do
begin
if i=j then begin
inc(m);
break;
end;
if x[i]+x[j]<=w then
begin
inc(i); dec(j); inc(m);
end;
if x[i]+x[j]>w then
begin
inc(m);
dec(j);
end;
end;
end;
procedure print;
begin
writeln(m);
close(output);
end;
begin
init;
qsort(1,n);
main;
print;
end.