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