#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x;
  cin >> N >> x;
  vector<int> vec(N, 0);
  int ans = 0;
  int sum = 0;
  for (int i = 0; i < N; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  while (sum < x) {
    sum += vec[ans];
    ans++;
  }
  cout << ans;
}
