  ll N, A;
  cin >> N >> A;
  vector<ll> x;
  x.pb(0);
  rep(i,N){
    ll inp; cin >> inp;
    x.pb(inp);
  }
 
  rep(i,N)dp[i][0][0]=1;//0枚選んで合計0のやつが全部1通り
 
  for(ll i =1;i<=N;i++){
    for(ll j = 1;j<=N;j++){
      for(ll k = 1;k<=3000;k++){
	if(k<x[i])dp[i][j][k]=dp[i-1][j][k];
	else dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-x[i]];
      }	
    }
  }
  ll ans =0;
  rep(i,N+1){
    if (i==0) continue;
    ans += dp[N][i][i*A];
  }
  cout << ans << endl;
  
  return 0;
}
