#include <bits/stdc++.h>
using namespace std;
int max(int a, int b) { return (a >= b) ? a : b; }
int main(int argc, char const *argv[]) {
  int n, x;
  cin >> n >> x;
  vector<int> a(n, 0);
  for (auto i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<vector<int> > d(2, vector<int>(x + 1, 0));
  for (auto i = 1; i < x + 1; ++i) {
    d[0][i] = (i == a[0] ? 1 : 0);
  }
  int f = 1;
  for (auto j = 1; j < n; ++j) {
    for (auto i = 1; i < x + 1; ++i) {
      if (i - a[j] >= 0) {
        d[f][i] = max(d[1 - f][i - a[j]] + 1, d[1 - f][i]);
      } else {
        d[f][i] = d[1 - f][i];
      }
    }
    f = 1 - f;
  }
  cout << d[1 - f][x] << endl;
  return 0;
}
