#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using namespace std;
bool isPrimeNum(ll x) {
  if (x <= 1) {
    return false;
  }
  int n = (int)sqrt((double)x);
  for (int i = 2; i <= n; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
ll myPow(ll x, ll n, ll m) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
constexpr ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
constexpr ll abs(ll a, ll b) {
  if (a >= b) return a - b;
  if (a < b) return b - a;
}
constexpr ll min(ll a, ll b) {
  if (a >= b) return b;
  if (a < b) return a;
}
constexpr ll max(ll a, ll b) {
  if (a >= b) return a;
  if (a < b) return b;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct UnionFind {
  vector<int> par;
  UnionFind(int N) : par(N) {
    for (int i = 0; i < N; i++) par[i] = i;
  }
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};
priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
int main() {
  ll N, A;
  cin >> N >> A;
  ll x[N];
  for (int i = (0); i <= (N - 1); i++) {
    cin >> x[i];
    x[i] = x[i] - A;
  }
  ll dp[2001][51];
  for (int i = (0); i <= (2000); i++) {
    for (int j = (0); j <= (50); j++) {
      dp[i][j] = 0;
    }
  }
  dp[1000][0] = 1;
  for (int i = (1); i <= (N); i++) {
    for (int j = (0); j <= (2000); j++) {
      if (dp[j][i - 1] >= 1) {
        dp[j][i] = dp[j][i] + dp[j][i - 1];
        dp[j + x[i - 1]][i] = dp[j + x[i - 1]][i] + dp[j][i - 1];
      }
    }
  }
  cout << dp[1000][N] - 1 << endl;
  return 0;
}
