var n,i,tt,time,ans:longint;
    a:array[0..100000]of longint;
   // u:array[1..100000]of boolean;
procedure swap(var a,b:longint);
var t:longint;
begin
t:=a; a:=b; b:=t;
end;
procedure qsort(l,r:longint);
var i,j,mid:longint;
begin
 i:=l; j:=r; mid:=abs(a[(l+r) div 2]);
 repeat
  while abs(a[i])<mid do inc(i);
  while abs(a[j])>mid do dec(j);
  if i<=j then begin
   swap(a[i],a[j]);
  // swap(u[i],u[j]);
   inc(i);
   dec(j);
  end;
 until i>j;
 if i<r then qsort(i,r);
 if j>l then qsort(l,j);
end;
begin
 readln(time,n);
 //fillchar(u,sizeof(u),true);
 for i:=1 to n do readln(a[i]);
 qsort(1,n);
 //for i:=1 to n do write(a[i],' ');
 i:=0;
 while time>=0 do begin
  time:=time-abs(a[i]-a[i+1]);
  inc(i);
 end;
 writeln(i-1) ;
 close(input);
 close(output);
end.