#include <bits/stdc++.h>
using namespace std;
vector<int> v, z;
int main() {
  long long n, t, c, cnt = 0, f = 0, a = 0;
  cin >> n >> t;
  long long x[n], y[n];
  for (int i = 0; i < n; i++) {
    cin >> c;
    v.push_back(c);
  }
  sort(v.begin(), v.end(), greater<int>());
  for (int i = 0; i < n; i++) {
    if (a >= t) {
      break;
    } else
      ;
    {
      a += v[i];
      f++;
    }
  }
  cout << f;
}
