#include <bits/stdc++.h>
using namespace std;
long long int dp[50][5001];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, A;
  cin >> N >> A;
  int x[N];
  for (int i = int(0); i < int(N); i++) {
    cin >> x[i];
    x[i] -= A;
  }
  for (int i = int(0); i < int(N); i++) {
    if (i == 0) {
      dp[i][x[0] + 2500] = 1;
      dp[i][2500] = 1;
    } else {
      for (int j = int(0); j < int(5001); j++) {
        dp[i][j] =
            dp[i - 1][j] +
            (0 <= j - x[i] && j - x[i] <= 5000 ? dp[i - 1][j - x[i]] : 0);
      }
    }
  }
  cout << dp[N - 1][2500] - 1 << "\n";
}
