#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Pair = pair<ll, ll>;
int main() {
  ll n, x;
  cin >> n >> x;
  vector<ll> as(n);
  for (auto& v : as) cin >> v;
  sort(as.begin(), as.end());
  ll count = 0;
  ll i = 0;
  for (; i < n; i++) {
    count += as[i];
    if (count >= x) break;
  }
  cout << i + 1 << endl;
}
