#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, a, i, j, x[50], dp[50][5010] = {}, xt, min, max;
  cin >> n >> a;
  for (i = 0; i < n; i++) {
    cin >> xt;
    x[i] = xt - a;
  }
  dp[0][2500]++;
  dp[0][x[0] + 2500]++;
  if (x[0] >= 0) {
    min = 2500;
    max = x[0] + 2500;
  } else {
    min = x[0] + 2500;
    max = 2500;
  }
  for (i = 1; i < n; i++) {
    for (j = min; j <= max; j++)
      if (dp[i - 1][j]) {
        dp[i][j] += dp[i - 1][j];
        dp[i][j + x[i]] += dp[i - 1][j];
      }
    if (x[i] > 0)
      max += x[i];
    else
      min += x[i];
  }
  cout << dp[n - 1][2500] - 1 << endl;
  return 0;
}
