#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long lint;
const int N = 45;
lint read () {
lint x = 0, f = 1; char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
lint n, mid, cntl, cntr, a[N], M;
vector<lint> l, r;
void ldfs (lint k, lint cost) {
if (cost > M) return;
if (k == mid) {
l.push_back(cost);
return;
}
ldfs (k + 1, cost + a[k]);
ldfs (k + 1, cost);
return;
}
void rdfs (lint k, lint cost) {
if (cost > M) return;
if (k == n + 1) {
r.push_back(cost);
return;
}
rdfs (k + 1, cost + a[k]);
rdfs (k + 1, cost);
return;
}
lint ans;
int main() {
n = read(), M = read();
mid = n / 2;
for (int i = 1; i <= n; i++) a[i] = read();
sort (a + 1, a + 1 + n);
ldfs (1, 0); rdfs (mid, 0);
sort (l.begin(), l.end());
for (int i = 0; i < r.size(); i++) {
if (M - r[i] < 0) continue;
ans += upper_bound(l.begin(), l.end(), M - r[i]) - l.begin();
}
printf("%lld", ans);
return 0;
}