#include <bits/stdc++.h>
using namespace std;
long long n, s, a[111], ans;
bool u[111];
void rec(long long sum, long long len) {
  if (!sum) {
    ans = max(ans, len);
    return;
  } else if (len == n) {
    ans = max(ans, len - 1);
  }
  for (int i = 1; i <= n; ++i) {
    if (!u[i]) {
      if (sum - a[i] >= 0) {
        u[i] = 1;
        rec(sum - a[i], len + 1);
        u[i] = 0;
      }
    }
  }
}
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  rec(s, 0);
  cout << ans;
  return 0;
}
