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