#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int m;
  cin >> m;
  int s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s, s + n, greater<int>());
  int sum = 0;
  int c = 0;
  for (int i = 0; i < n; i++) {
    sum += s[i];
    c++;
    if (sum >= m) break;
  }
  cout << c << endl;
  return 0;
}
