#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long x;
  cin >> n >> x;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr.begin(), arr.end());
  int j = 0;
  int count = 0;
  long long ans = 0;
  while (1) {
    if (x <= ans) {
      break;
    }
    ans = ans + arr[j];
    count++;
    j++;
  }
  cout << count << endl;
  return 0;
}
