#include<bits/stdc++.h>
using namespace std;
int n, m;
int a[105], vis[105];
int cnt = 0;
void dfs(int x, int s) {
if (s == 0) {
cnt++;
return ;
}
for (int i = x; i < n; i++) {
if (!vis[i]) {
vis[i] = 1;
dfs(i, s - a[i]);
vis[i] = 0;
}
}
}
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++) cin >> a[i];
dfs(0, m);
cout << cnt << endl;
return 0;
}