#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x;
  cin >> n >> x;
  map<long long, int> sums;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    map<long long, int> cur_sums;
    for (auto& kv : sums)
      cur_sums[kv.first + a] = max(cur_sums[kv.first + a], kv.second + 1);
    cur_sums[a] = max(cur_sums[a], 1);
    sums = cur_sums;
  }
  int max_happy = 0;
  for (auto kv : sums) {
    if (kv.first < x)
      max_happy = max(max_happy, kv.second - 1);
    else if (kv.first == x)
      max_happy = max(max_happy, kv.second);
    else
      break;
  }
  cout << max_happy;
}
