#include <bits/stdc++.h>
using namespace std;
int usb[123] = {0};
int main() {
  int n, m, sum = 0, res = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> usb[i];
  }
  sort(usb, usb + n);
  reverse(usb, usb + n);
  for (int i = 0; i < n; i++) {
    sum += usb[i];
    res++;
    if (sum >= m) break;
  }
  cout << res << endl;
  return 0;
}
