program ex;
type
ss=array[1..30000]of integer;
var
a:ss;
w,n:integer;
f1,f2:text;
min:integer;
procedure init;
var
i:integer;
begin
assign(f1,'group.in');
assign(f2,'group.out');
reset(f1);
rewrite(f2);
readln(f1,w);
readln(f1,n);
for i:=1 to n do
readln(f1,a[i]);
end;
procedure qsort(l,r:integer);
var
i,j,x,y:integer;
begin
i:=l;
j:=r;
x:=a[(l+r)div 2];
repeat
while a[i]<x do inc(i);
while a[j]>x do dec(j);
if i<=j then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
dec(j);
end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
procedure main;
var
i,j:integer;
begin
min:=0;
i:=n;j:=1;
while (j<=i) do
begin
if (a[i]+a[j]<=w)and(j<i) then
begin
inc(j);
dec(i);
end
else dec(i);
inc(min);
end;
end;
begin
init;
qsort(1,n);
main;
write(f2,min);
close(f1);
close(f2);
end.