#include <bits/stdc++.h>
int distribute(std::vector<int> a, int offset, int rest, int count) {
  int v = count;
  if (a.size() > offset + 1) {
    int nv;
    if (rest >= a.at(offset)) {
      nv = distribute(a, offset + 1, rest - a.at(offset), count + 1);
      if (nv > v) {
        v = nv;
      }
      nv = distribute(a, offset + 1, rest, count);
      if (nv > v) {
        v = nv;
      }
    }
  } else {
    if (rest == a.at(offset)) {
      int nv = count + 1;
      if (nv > v) {
        v = nv;
      }
    }
  }
  return v;
}
int main(int argc, char **argv) {
  int N, x;
  std::cin >> N >> x;
  std::vector<int> a(N);
  for (int i = 0; i < N; i++) {
    std::cin >> a.at(i);
  }
  std::sort(a.begin(), a.end());
  int ans = distribute(a, 0, x, 0);
  std::cout << ans << std::endl;
}
