#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x;
  cin >> n >> x;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  map<long long, int> score;
  score[0] = 0;
  for (auto it = a.begin(); it != a.end(); ++it) {
    auto s2 = score;
    for (auto sit = s2.begin(); sit != s2.end(); ++sit) {
      auto key = sit->first;
      if (key + *it <= x) {
        score[key + *it] = max(score[key + *it], score[key] + 1);
      } else {
        break;
      }
    }
  }
  auto ret = 0;
  auto max_score = x;
  for (auto it = score.begin(); it != score.end(); ++it) {
    if (it->second > ret) {
      ret = it->second;
      max_score = it->first;
    }
  }
  if (ret == n && max_score != x) {
    ret -= 1;
  }
  cout << ret << endl;
  return 0;
}
