#include using namespace std; using ll = long long; const ll MOD = 1000000007; using P = pair; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main(){ ll n,w; cin >> n >> w; vector a(n); rep(i,n) cin >> a[i]; int ans = 0; rep(i,pow(2,n)){ if(!i) continue; ll tot = 0; vector sel; int x = i, j = 0; while(x){ if(x%2){ sel.push_back(j); tot += a[j]; } j++; x /= 2; } for(int y:sel){ if(tot-a[y]/2 == w) ans++; } ans += (w == tot); } cout << ans << endl; return 0; }