#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0, to = 0, n, s;
  cin >> n >> s;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) {
    to = to + a[i];
    count++;
    if (to >= s) break;
  }
  cout << count;
}
