program cojs121;
const
maxn=30000;
var
a:array[1..maxn] of integer;
i,n,max,ans,fr,ta:longint;
procedure qp(l,r:longint);
var
i,j,x,y:longint;
begin
randomize;
x:=a[random(r-l+1)+l];
i:=l;j:=r;
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 j>l then qp(l,j);
if i<r then qp(i,r);
end;
begin
assign(input,'group.in');
assign(output,'group.out');
reset(input);
rewrite(output);
readln(max);
readln(n);
for i:=1 to n do
readln(a[i]);
qp(1,n);
fr:=1; ta:=n;
while fr<ta do
if a[fr]+a[ta]<=max then
begin
inc(fr);dec(ta);inc(ans);
end
else
begin
dec(ta); inc(ans);
end;
if ta=fr then
inc(ans);
writeln(ans);
close(input);
close(output);
end.