#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x, a[110], s = 0;
  cin >> N >> x;
  for (int i = 0; i < N; i++) cin >> a[i];
  sort(a, a + N);
  for (int i = 0; i < N; i++) {
    if (x <= s) {
      cout << i << endl;
      break;
    } else
      s += a[i];
  }
  return 0;
}
