#include #include using namespace std; int main() { int N; long long W; cin >> N >> W; vector A(N); for (auto &x : A) cin >> x; int ret = 0; for (int s = 0; s < 1 << N; ++s) { bool good = false; for (int t = s;; t = (t - 1) & s) { long long sum = 0; for (int i = 0; i < N; ++i) sum += (((s >> i) & 1) + ((t >> i) & 1)) * A[i]; good |= (sum == W * 2); if (t == 0) break; } ret += good; } cout << ret << '\n'; }