#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
int main() {
  int N, A;
  cin >> N >> A;
  vector<int> a(N);
  for (int i = 0; i < (int)(N); ++i) cin >> a[i];
  vector<vector<vector<int>>> dp(
      N + 1, vector<vector<int>>(N + 1, vector<int>(2510, 0)));
  dp[0][0][0] = 1;
  for (int i = 0; i < (int)(N); ++i)
    for (int j = 0; j < (int)(N + 1); ++j)
      for (int k = 0; k < (int)(2510); ++k) {
        dp[i + 1][j][k] += dp[i][j][k];
        if (j + 1 <= N && k + a[i] <= 2500)
          dp[i + 1][j + 1][k + a[i]] += dp[i][j][k];
      }
  lint ans = 0;
  for (int i = 1; i <= N; ++i) ans += dp[N][i][A * i];
  cout << ans << "\n";
  return 0;
}
