#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, x;
  cin >> n >> x;
  long long int a[110], sum = 0;
  for (int i = 0; i < (n); i++) cin >> a[i];
  ;
  for (int i = 0; i < n; i++) sum += a[i];
  if (sum == x) cout << n << endl;
  long long int cnt = 0;
  sort(a, a + n, greater<int>());
  for (int i = 0; i < n; i++) {
    sum -= a[i];
    cnt++;
    if (sum <= x) {
      cout << n - cnt << endl;
      break;
    }
  }
}
