#include <bits/stdc++.h>
using namespace std;
vector<int> vplus, vminus, vp, vm;
int sumplus, summinus, sumlimit;
void dfs_p(int a, int b) {
  if (b > sumlimit) {
    return;
  }
  vp[b + vplus[a]] += 1;
  if (a + 1 < vplus.size()) {
    dfs_p(a + 1, b + vplus[a]);
    dfs_p(a + 1, b);
  }
  return;
}
void dfs_m(int a, int b) {
  if (b > sumlimit) {
    return;
  }
  vm[b + vminus[a]] += 1;
  if (a + 1 < vminus.size()) {
    dfs_m(a + 1, b + vminus[a]);
    dfs_m(a + 1, b);
  }
  return;
}
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int main() {
  int n, a;
  cin >> n >> a;
  int x;
  long long zero = 0;
  sumplus = 0;
  summinus = 0;
  vp.assign(2500, 0);
  vm.assign(2500, 0);
  for (int i = 0; i < n; i++) {
    cin >> x;
    x -= a;
    if (x > 0) {
      vplus.push_back(x);
      sumplus += x;
    } else if (x < 0) {
      vminus.push_back(-x);
      summinus -= x;
    } else if (x == 0) {
      zero += 1;
    }
  }
  sumlimit = min(sumplus, summinus);
  long long ans = 0;
  if (vplus.size() > 0) dfs_p(0, 0);
  if (vminus.size() > 0) dfs_m(0, 0);
  for (int i = 0; i < vp.size(); i++) {
    ans += vp[i] * vm[i];
  }
  if (zero > 0) {
    ans = ans * (binpow(2, zero)) + binpow(2, zero) - 1;
  }
  cout << ans << endl;
  return 0;
}
