var
v,n,g,ans:longint;
a,r:array[1..1000000] of longint;
procedure sort(s,t:longint);
var
m,i,j,k:longint;
begin
if s=t then exit;
m:=(s+t) div 2;
sort(s,m);
sort(m+1,t);
i:=s; j:=m+1; k:=s;
while (i<=m) and (j<=t) do
if a[i]<=a[j] then
begin r[k]:=a[i]; inc(i); inc(k); end
else begin
r[k]:=a[j]; inc(j); inc(k); end;
while i<=m do begin r[k]:=a[i]; inc(i); inc(k); end;
while j<=t do begin r[k]:=a[j]; inc(j); inc(k); end;
for i:=1 to t do a[i]:=r[i];
end;
begin
assign(input,'jiahao1.in'); reset(input);
assign(output,'jiahao1.out'); rewrite(output);
read(v,n);
for g:=1 to n do read(a[g]);
sort(1,n);
for g:=1 to n do
if v>a[g] then
begin inc(ans); v:=v+(a[g] div 2); end;
write(ans);
close(input);
close(output);
end.