#include <bits/stdc++.h>
using namespace std;
const long long linf = 1001002003004005006ll;
const int inf = 1001001001;
const int mod = 1000000007;
int n, x;
vector<int> a(105);
int ans;
int d;
map<int, int> mp;
void dfs(int now = x, int cnt = 0) {
  if (now <= 0 || cnt == n) {
    if (now == 0) ans = max(ans, d);
    if (now < 0 || now > 0) ans = max(ans, d - 1);
    return;
  }
  for (int i = 0; i < n; ++i) {
    if (mp[i]) continue;
    mp[i] = true;
    d++;
    dfs(now - a[i], cnt + 1);
    d--;
    mp[i] = false;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> x;
  for (int i = 0; i < (n); ++i) cin >> a[i];
  ans = 0;
  d = 0;
  dfs();
  cout << ans << endl;
  return 0;
}
