#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void err() { cout << "" << endl; }
template <template <typename...> class T, typename t, typename... Args>
void err(T<t> a, Args... args) {
  for (auto x : a) cout << x << ' ';
  err(args...);
}
template <typename T, typename... Args>
void err(T a, Args... args) {
  cout << a << ' ';
  err(args...);
}
const int N = 200;
LL n, x, a[N], b[N];
int main() {
  cin >> n >> x;
  for (decay<decltype(n)>::type i = (0), _i = (n); i < _i; ++i) cin >> a[i];
  sort(a, a + n);
  partial_sum(a, a + n, b);
  LL ans = 0;
  for (decay<decltype(n)>::type i = (0), _i = (n); i < _i; ++i) {
    if (b[i] < x)
      ans = i;
    else if (b[i] == x)
      ans = i + 1;
  }
  cout << ans << endl;
}
