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