#include<bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n >> x;
int arr[n];
for(int i = 0; i < n; i++) cin >> arr[i];
sort(arr, arr+n);
for(int i = 1; i < n; i++) arr[i] = arr[i] + arr[i-1];
int pos = upper_bound(arr, arr+n, x):
cout << pos << endl;
}