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