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