const
maxnum=10000;
type
tdata=array[0..maxnum] of longint;
var
n,w,i,j,vans,vuse:longint;
data:tdata;
dause:array[0..maxnum] of boolean;
procedure gcqsort(var data:tdata; st,en:longint);
var
i,j,mid,temp:longint;
begin
i:=st;
j:=en;
mid:=data[(st+en) div 2];
while (i<=j) do
begin
while (data[i]<mid) do
inc(i);
while (data[j]>mid) do
dec(j);
if (i<=j) then
begin
mid:=data[i];
data[i]:=data[j];
data[j]:=mid;
inc(i);
dec(j);
end;
end;
if (st<j) then
gcqsort(data,st,j);
if (i<en) then
gcqsort(data,i,en);
end;
begin
assign(input,'group.in');
reset(input);
assign(output,'group.out');
rewrite(output);
readln(w);
readln(n);
fillchar(dause,sizeof(dause),true);
for i:=1 to n do
readln(data[i]);
gcqsort(data,1,n);
vans:=0;
for i:=n downto 1 do
if (dause[i]) then
begin
dause[i]:=false;
inc(vans);
for j:=1 to n do
if (data[j]+data[i]<=w) and (dause[j]) then
dause[j]:=false;
end;
writeln(vans);
close(input);
close(output);
end.