#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int N;
	int x;
	int tmp = 0;
	int answer = 0;

	cin >> N >> x;

	vector<int> a(N);

	for (int i = 0; i < N; i++) {
		cin >> a.at(i);
		tmp += a.a(i);
	}
	
	sort(a.begin(), a.end() ); // 昇順にソート

	int i = 0;
	while ( tmp > 0 ) {		
		if (tmp - a.at(i) > 0) {
			tmp -= a.at(i);
			i++;
		}
		else {
			break;
		}		
	}

	answer = i;

	cout << answer << endl;
	return 0;
}