#include <bits/stdc++.h>
int n;
std::vector<int> a;
std::map<std::pair<int, int>, int> table;
int solve(int x, int i) {
  if (i == n) {
    return 0;
  }
  if (x == 0) {
    return 0;
  }
  std::pair<int, int> key = std::make_pair(x, i);
  std::map<std::pair<int, int>, int>::const_iterator it = table.find(key);
  if (it != table.end()) {
    return it->second;
  }
  if (i == n - 1) {
    if (a[i] == x) {
      return 1;
    } else {
      return 0;
    }
  }
  if (x < a[i]) {
    table[key] = 0;
    return 0;
  }
  int v = solve(x - a[i], i + 1) + 1;
  int w = solve(x, i + 1);
  int r = std::max(v, w);
  table[key] = r;
  return r;
}
int main() {
  int x;
  std::cin >> n >> x;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  std::sort(a.begin(), a.end());
  std::cout << solve(x, 0) << std::endl;
  return 0;
}
