program sss;
var
s:array [0..1000000] of real;v,x:real;
a,b,c,d,e,n,h,i,z,y,k:longint;
begin
assign(input,'jiahao1.in');
reset(input);
assign(output,'jiahao1.out');
rewrite(output);
read(v,n);
for c:=1 to n do
begin
readln(d);
if v>d then
begin
v:=v+d / 2;
z:=z+1;
end
else
begin
e:=e+1;
s[e]:=d;
end;
end;
y:=e;k:=e;
for h:=y downto 1 do if v>s[h] then begin k:=k-1;v:=v+s[h]/2;z:=z+1;s[h]:=-1; end;
if k<>0 then
for h:=1 to k do
begin
for i:=h to k do
if (s[h]>s[i]) and (s[h]<>-1) and (s[i]<>-1) then begin x:=s[h];s[h]:=s[i];s[i]:=x;end;
if (v>s[h]) and (s[h]<>-1) then begin z:=z+1;v:=v+s[h]/2;end else break;
end;
writeln(z);
close(input);
close(output);
end.