#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x;
  cin >> n >> x;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  unordered_map<long long, long long> mp;
  sort(a.begin(), a.end());
  mp[0] = 0;
  auto mp2 = mp;
  for (auto it = a.begin(); it != a.end(); ++it) {
    for (auto mi = mp.begin(); mi != mp.end(); ++mi) {
      auto j = mi->first + *it;
      if (j > x) continue;
      mp2[j] = mi->second + 1;
    }
    mp = mp2;
  }
  auto sl = max_element(mp.begin(), mp.end(),
                        [](const pair<int, int>& p1, const pair<int, int>& p2) {
                          return p1.second < p2.second;
                        });
  auto ret = sl->second;
  if ((sl->first != x) and (sl->second - a.size() == 0)) ret -= 1;
  cout << ret << endl;
  return 0;
}
