#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, s, ans = 0, counter = 0;
  cin >> n >> s;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  while (ans < s) {
    counter++;
    ans += a[n - counter];
  }
  cout << counter;
  return 0;
}
