#include <bits/stdc++.h>
#define reps(i,a,b) for(long long int i=a;i<b;i++)
#define rep(i,a) for(long long int i=0;i<a;i++)
typedef long long int ll;
using namespace std;
ll MOD = 1000000007;

ll dp[55][55][200000];
int N,A;
int x[50];
const int MAX = 510000;

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

//再帰関数、下の方を先に計算させる感覚

ll dpp(int basho,int maisu,int gouke){
    if(basho>=N){
        if(gouke==maisu*A && maisu!=0){
        return 1;//一番下では１（？）
        }
        else{
            return 0;
        }
    }
    if (dp[basho][maisu][gouke] != -1){
        return dp[basho][maisu][gouke];
    }


    int yes = dpp(basho+1,maisu+1,gouke+x[basho]);
    int no = dpp(basho+1,maisu,gouke);

    dp[basho][maisu][gouke]= yes+no;
    
    return dp[basho][maisu][gouke];
}



int main(){
    cin>>N>>A;
    rep(i,N){
        cin>>x[i];
    }
    memset(dp, -1, sizeof(dp));//初期化

    cout<<dpp(0,0,0)<<endl;



    return 0;
}