#include <bits/stdc++.h>
using namespace std;
int main() {
  int u, j, v, c = 0, d = 0;
  cin >> u >> v;
  int w[u];
  for (j = 0; j < u; j++) {
    cin >> w[j];
  }
  sort(w, w + u);
  for (int k = u - 1; k >= 0; k--) {
    c += w[k];
    d++;
    if (c >= v) {
      break;
    }
  }
  cout << d << endl;
  return 0;
}
