#include <bits/stdc++.h>

using namespace std;
ifstream f1("explore.inp");
ofstream f2("explore.out");
bool cmp(int &a, int &b)
{
	return abs(a) < abs(b);
}
int main() {
	int a[500000],t,n,i,b[500000],tong=0,d=0;;
	a[0]=0;
	f1>>t>>n;
	for (i=1;i<=n;i++)
	{f1>>a[i];}
	sort (a+1,a+1+n, cmp); 
	for (i=1;i<=n;i++)
	{tong=tong+abs(a[i]-a[i-1]); d++; 
	 if (tong>t) break;
	}
	f2<<d-1;
	return 0;
}
