#include <bits/stdc++.h>
using namespace std;
map<long long, long long> temp[250];
map<long long, long long> vis[250];
long long rec(long long a[], long long x, long long ind) {
  if (vis[ind][x] != 0) return temp[ind][x];
  vis[ind][x] = 1;
  if (ind == 0) {
    if (x == a[0]) {
      vis[ind][x] = 1;
      temp[ind][x] = 1;
    } else {
      vis[ind][x] = 1;
      temp[ind][x] = 0;
    }
  } else if (x >= a[ind])
    temp[ind][x] = max(rec(a, x - a[ind], ind - 1) + 1, rec(a, x, ind - 1));
  else
    temp[ind][x] = rec(a, x, ind - 1);
  return temp[ind][x];
}
int main() {
  long long n, x;
  cin >> n >> x;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << rec(a, x, n - 1) << endl;
}
