#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int zero = 1500;
int main() {
  int n, a;
  cin >> n >> a;
  vector<int> an(n);
  for (int i = 0; i < n; ++i) cin >> an[i];
  vector<vector<ll>> dp(n, vector<ll>(3000, 0));
  dp[0][zero] = 1;
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      dp[i][zero + an[i] - a] += 1;
      continue;
    }
    for (int j = 0; j < 3000; ++j) {
      dp[i][j] = dp[i - 1][j];
      if (j + an[i] - a >= 0 && j + an[i] - a < 3000) {
        dp[i][j] += dp[i - 1][j - (an[i] - a)];
      }
    }
  }
  cout << dp[n - 1][zero] - 1 << endl;
}
