#include <bits/stdc++.h>
using namespace std;
void ARC060C() {
  int N, A;
  cin >> N >> A;
  vector<int> vals(N);
  for (auto& x : vals) {
    cin >> x;
  }
  vector<vector<vector<long long> > > dp(
      N + 1, vector<vector<long long> >(N + 1, vector<long long>(2501)));
  dp[1][1][vals.front()] = 1;
  for (int i = 1; i < N; ++i) {
    dp[i][0][0] = 1;
    for (int j = 1; j <= i; ++j) {
      for (int k = 1; k <= 2500; ++k) {
        int res = k - vals[i];
        dp[i + 1][j][k] = dp[i][j][k];
        if (res >= 0 && res < 2501) dp[i + 1][j][k] += dp[i][j - 1][res];
      }
    }
  }
  long long sum = 0;
  for (int i = 1; i <= N; ++i) {
    sum += dp[N][i][A * i];
  }
  cout << sum << endl;
}
int main() {
  ARC060C();
  return 0;
}
