#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=55;
int n,A,a[N],ans,dp[N][N][N*N];
signed main(){
	scanf("%lld%lld",&n,&A);
	for (int i=1;i<=n;i++)scanf("%lld",&a[i]);
	dp[0][0][0]=1;
	for (int i=1;i<=n;i++)
		for (int j=0;j<=n;j++)
			for (int k=0;k<=n*50;k++){
				dp[i][j][k]+=dp[i-1][j][k];
				if (j&&k>=a[i])dp[i][j][k]+=dp[i-1][j-1][k-a[i]];
			}
	for (int i=1;i<=n;i++)ans+=dp[n][i][i*A];
	printf("%lld\n",ans);
}