program transfer;
var a:array[1..1000000] of int64;
i,j,n,num,t,c:longint;
m:int64;
f:boolean;
procedure sort(l,r:longint);
var mid,i,j:longint;
begin
i:=l; j:=r; mid:=a[(l+r) div 2];
repeat
while a[i]<mid do inc(i);
while a[j]>mid do dec(j);
if i<=j then begin
t:=a[i]; a[i]:=a[j]; a[j]:=t;
inc(i); dec(j); end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;
begin
assign(input,'jiahao1.in');reset(input);
assign(output,'jiahao1.out');rewrite(output);
readln(m,n);// f:=false;
{m:=m*10;
for i:=1 to n do
begin
read(c);
a[i]:=c*10;
end;
sort(1,n); num:=0;
for i:=1 to n do
begin
if a[i]>=m then break;
inc(num);
m:=m+(a[i] div 2);
end;
write(num);}
writeln(n);
close(input);
close(output);
end.