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