var
b:array[1..30000]of boolean;
a:array[1..30000]of longint;
zong,n,m,i,t:longint;
procedure qsort(l,r:longint);
var
i,j,x,y:longint;
begin
i:=l;j:=r;x:=a[(l+r) div 2];
repeat
while a[i]<x do inc(i);
while x<a[j] do dec(j);
if not(i>j) then
begin
y:=a[i];a[i]:=a[j];a[j]:=y;
inc(i);j:=j-1;
end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
assign(input,'group.in');reset(input);
assign(output,'group.out');rewrite(output);
read(m,n);zong:=0;
for i:=1 to n do read(a[i]);
qsort(1,n);fillchar(b,sizeof(b),true);
for i:=1 to n do
if b[i]=true then
begin
b[i]:=false;t:=i;
while (t+1<=n) and (a[t+1]+a[i]<=m) and (b[t+1]=true) do t:=t+1;
b[t]:=false;zong:=zong+1;
end;
writeln(zong);
close(input);close(output);
end.