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