#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m;
  const int maxn = 105;
  int a[maxn];
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int tot = 0;
  int result = 0;
  for (int i = n - 1; i >= 0; i--) {
    tot += a[i];
    result++;
    if (tot >= m) break;
  }
  cout << result << endl;
}
