#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<T> &v) {
  for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
    out << v[i] << " ";
  out << "\n";
  return out;
}
template <typename T, typename N>
std::ostream &operator<<(std::ostream &out, vector<pair<T, N> > &v) {
  for (size_t i = 0; i < v.size(); ++i)
    out << "(" << v[i].first << ", " << v[i].second << ") ";
  out << "\n";
  return out;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<vector<T> > &v) {
  for (size_t i = 0; i < v.size(); ++i) {
    for (size_t j = 0; j < v[i].size(); ++j) {
      out << v[i][j] << " ";
    }
    out << "\n";
  }
  return out;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, x;
  cin >> n >> x;
  vector<int> candies(n);
  for (int i = 0; i < n; ++i) {
    cin >> candies[i];
  }
  sort(candies.begin(), candies.end());
  int max_children = 0;
  for (int i = 0; i < n; ++i) {
    if (x >= candies[i]) {
      ++max_children;
      x -= candies[i];
    } else {
      cout << max_children << "\n";
      return 0;
    }
  }
  if (x) {
    vector<pair<int, int> > values;
    for (int i = 1; i <= n; ++i) {
      int sum = 0;
      for (int j = 0; j < i; ++j) {
        sum += candies[j];
      }
      values.push_back({i, sum});
      for (int j = i; j < n; ++j) {
        sum -= candies[j - i];
        sum += candies[j];
        values.push_back({i, sum});
      }
    }
    sort(values.begin(), values.end());
    for (int i = 0; i < (int)values.size(); ++i) {
      if (x % values[i].second == 0) {
        cout << max(0, max_children - values[i].first) << "\n";
        return 0;
      }
    }
    cout << 0 << "\n";
    return 0;
  }
  cout << max_children << "\n";
  return 0;
}
