#include <fstream>
#include <queue>
#include <algorithm>

using namespace std;

ifstream input("EXPLORE.inp");
ofstream output("EXPLORE.out");

int ABS(int a)
{
	return (a > 0) ? a : -a;
}

int compare(int a, int b)
{
	return ABS(a) < ABS(b);
}

int main()
{
	int t, n;
	int count = 0;
	int b;
	input >> t >> n;
	deque <int> a(n);
	for (int i = 0; i < n; i++)
	{
		input >> a[i];
	}
	sort(a.begin(), a.end(), compare);
	b = 0;
	int i = 0;
	while (count <= t)
	{
		count += ABS(a.front() - b);
		b = a.front();
		a.pop_front();
	}
	output << n - a.size() - 1;
	input.close();
	output.close();
}