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