#include <bits/stdc++.h>
using namespace std;
int main() {
  long long y, x, t, n, c, i, j, s = 0, s1, s2, k;
  cin >> n >> k;
  int m[n];
  for (i = 0; i < n; i++) {
    cin >> m[i];
  }
  sort(m, m + n, greater<int>());
  s1 = 0, s2 = 0;
  for (i = 0; i < n; i++) {
    s1 += m[i];
    s2++;
    if (s1 >= k) break;
  }
  cout << s2 << endl;
}
