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