#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

void subset_sum(const vector<ll>&v,map<pair<ll,ll>,ll>&res,ll ss=0,ll depth=0,ll added=0)
{
    if(depth==v.size()){
        ++res[make_pair(ss,added)];
    }else{
        subset_sum(v,res,ss         ,depth+1,added);
        subset_sum(v,res,ss+v[depth],depth+1,added+1);
    }
}
int main()
{
    ll n=in(),a=in();
    vector<ll>x1(n/2),x2(n-n/2);
    for(auto&i:x1)i=in();
    for(auto&i:x2)i=in();

    map<pair<ll,ll>,ll>mp1,mp2;
    subset_sum(x1,mp1);
    subset_sum(x2,mp2);

    ll ans=0;
    for(const auto&s:mp1){
        auto p=s.first;
        ll cnt=s.second;
        for(ll m=p.second==0?1:0;m<=n-n/2;++m){
            auto foo=make_pair((p.second+m)*a-p.first,m);
            if(mp2.count(foo))ans+=cnt*mp2[foo];
        }
    }
    cout<<ans<<endl;
}
