#include<bits/stdc++.h>
#define MAXN 5005
#define LL long long
using namespace std;

const int C = 2500;
int N,A;
int x[MAXN];
LL dp[MAXN], temp[MAXN];

int main(){
	
	cin>>N>>A;
	
	dp[C] = 1;
	
	for(int i=1,x;i<=N;i++){
		cin>>x;
		x -= A;
		memcpy(temp, dp, sizeof(dp));
		
		for(int j=0;j<=2*C;j++){
			if(j+x>=0 && j+x<=2*C) temp[j] += dp[j+x];
		}
		memcpy(dp, temp, sizeof(temp));
	}
	
	cout<<dp[C] - 1<<endl;
	
	return 0;
}