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