#include <bits/stdc++.h>
using namespace std;
int a[110];
int s[110];
bool cmp(int x, int y) { return x > y; }
int main() {
  int n, m, i, j;
  while (cin >> n >> m) {
    for (i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1, cmp);
    s[0] = 0;
    for (i = 1; i <= n; i++) {
      s[i] = s[i - 1] + a[i];
      if (s[i] >= m) break;
    }
    cout << i << endl;
  }
  return 0;
}
