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