#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, S = 0;
  int T[100000];
  cin >> n;
  cin >> m;
  for (i = 0; i < n; i++) {
    cin >> T[i];
  }
  sort(T, T + n);
  i = n - 1;
  int z = 0;
  while (S < m) {
    S = S + T[i];
    i--;
    z++;
  }
  cout << z;
  return 0;
}
