#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
void subproblem(vector<int>::iterator s, vector<int>::iterator e, long long goal, unordered_map<int, long long> &miss)
{
int n = e - s;
for (int mask = 1; mask < (1 << n); mask++)
{
long long sum = 0;
for (int j = 0; j < n; j++)
sum += mask & (1 << j) ? *(s + j) : 0;
if (sum == goal)
ans++;
else if (sum < goal)
miss[sum]++;
}
}
void solve()
{
int n, x;
cin >> n >> x;
vector<int> t(n);
for (auto &i : t)
cin >> i;
sort(t.begin(), t.end());
int m = n / 2;
unordered_map<int, long long> mp1, mp2;
subproblem(t.begin(), t.begin() + m, x, mp1);
subproblem(t.begin() + m, t.end(), x, mp2);
for (auto [sum, v] : mp1)
{
if (mp2.find(x - sum) != mp2.end())
ans += v * mp2[x - sum];
}
cout << ans << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while (t--)
solve();
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpsb25nIGxvbmcgYW5zID0gMDsKCnZvaWQgc3VicHJvYmxlbSh2ZWN0b3I8aW50Pjo6aXRlcmF0b3IgcywgdmVjdG9yPGludD46Oml0ZXJhdG9yIGUsIGxvbmcgbG9uZyBnb2FsLCB1bm9yZGVyZWRfbWFwPGludCwgbG9uZyBsb25nPiAmbWlzcykKewogICAgaW50IG4gPSBlIC0gczsKICAgIGZvciAoaW50IG1hc2sgPSAxOyBtYXNrIDwgKDEgPDwgbik7IG1hc2srKykKICAgIHsKICAgICAgICBsb25nIGxvbmcgc3VtID0gMDsKICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGorKykKICAgICAgICAgICAgc3VtICs9IG1hc2sgJiAoMSA8PCBqKSA/ICoocyArIGopIDogMDsKCiAgICAgICAgaWYgKHN1bSA9PSBnb2FsKQogICAgICAgICAgICBhbnMrKzsKICAgICAgICBlbHNlIGlmIChzdW0gPCBnb2FsKQogICAgICAgICAgICBtaXNzW3N1bV0rKzsKICAgIH0KfQoKdm9pZCBzb2x2ZSgpCnsKICAgIGludCBuLCB4OwogICAgY2luID4+IG4gPj4geDsKICAgIHZlY3RvcjxpbnQ+IHQobik7CiAgICBmb3IgKGF1dG8gJmkgOiB0KQogICAgICAgIGNpbiA+PiBpOwogICAgc29ydCh0LmJlZ2luKCksIHQuZW5kKCkpOwoKICAgIGludCBtID0gbiAvIDI7CiAgICB1bm9yZGVyZWRfbWFwPGludCwgbG9uZyBsb25nPiBtcDEsIG1wMjsKICAgIHN1YnByb2JsZW0odC5iZWdpbigpLCB0LmJlZ2luKCkgKyBtLCB4LCBtcDEpOwogICAgc3VicHJvYmxlbSh0LmJlZ2luKCkgKyBtLCB0LmVuZCgpLCB4LCBtcDIpOwoKICAgIGZvciAoYXV0byBbc3VtLCB2XSA6IG1wMSkKICAgIHsKICAgICAgICBpZiAobXAyLmZpbmQoeCAtIHN1bSkgIT0gbXAyLmVuZCgpKQogICAgICAgICAgICBhbnMgKz0gdiAqIG1wMlt4IC0gc3VtXTsKICAgIH0KCiAgICBjb3V0IDw8IGFucyA8PCAiXG4iOwp9CgppbnQgbWFpbigpCnsKICAgIGlvczo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUoMCk7CiAgICBjb3V0LnRpZSgwKTsKCiAgICBpbnQgdCA9IDE7CiAgICAvLyBjaW4gPj4gdDsKICAgIHdoaWxlICh0LS0pCiAgICAgICAgc29sdmUoKTsKfQ==