#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 1;
int n, m, a[M], ans;
int main() {
  cin.tie(NULL), cout.tie(NULL), ios::sync_with_stdio(0);
  cin >> n >> m;
  for (auto i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  while (m > 0) {
    m -= a[n - 1];
    n--, ans++;
  }
  cout << ans;
}
