#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[101];
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int s = 0, sum = 0;
  for (int j = n - 1; j >= 0; j--) {
    sum += a[j];
    s++;
    if (sum < m)
      continue;
    else
      break;
  }
  cout << "\n" << s << endl;
  return 0;
}
