#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int x;
  istringstream iss(s);
  iss >> x;
  return x;
}
template <class T>
inline string toString(T x) {
  ostringstream oss;
  oss << x;
  return oss.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
static const auto io_sync_off = []() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  return nullptr;
}();
vector<long long> a;
map<long long, int> f;
int main(int argc, char* argv[]) {
  int n;
  long long x, y;
  cin >> n >> x;
  for (int i = 0; i < (int)n; ++i) {
    cin >> y;
    if (y <= x) a.push_back(y);
  }
  f[0] = 0;
  int ans = 0;
  for (int i = 0; i < (int)int((a).size()); ++i) {
    map<long long, int> g = f;
    for (const auto& kv : g) {
      if (kv.first + a[i] <= x && kv.second + 1 >= f[kv.first + a[i]]) {
        if (kv.first + a[i] == x) {
          if (kv.second + 1 > ans) ans = kv.second + 1;
        } else {
          if (kv.second > ans) ans = kv.second;
        }
        f[kv.first + a[i]] = kv.second + 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
