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