#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k = 0, s = 0;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  reverse(a, a + n);
  while (s < m) {
    s += a[k];
    k++;
  }
  cout << k << endl;
  return 0;
}
