#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[1001], ans = 0, i, j;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n, greater<int>());
  i = 0;
  while (m > 0) {
    ans++;
    m -= a[i];
    i++;
  }
  cout << ans;
  return 0;
}
