program quicksort;
var
i,j,x,y,max,n,m,b: longint;q:real;
a:array[0..1000000] of longint;
procedure sort(l,r: longint);
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
while a[i]<x do
inc(i);
while x<a[j] do
dec(j);
if not(i>j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
j:=j-1;
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(q,n);
for m:=1 to n do read(a[m]);
sort(1,n);
for m:=1 to n do
if q>a[m] then begin q:=q+a[m]/2;b:=b+1;end else break;
writeln(b);
close(input);
close(output);
end.