#include <bits/stdc++.h>
using namespace std;
int x[1070];
int main() {
  int n, m, v = 1, sum = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x[i];
  sort(x, x + n);
  for (int j = n - 1; j > 0; j--) {
    sum += x[j];
    if (sum >= m) break;
    v++;
  }
  cout << v;
  return 0;
}
