#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
template <typename T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
void co(const T n) {
  cout << n << endl;
}
template <typename T>
void cosp(const T n) {
  cout << n << ' ';
}
void coVec(const Vec &v) {
  for (ll i : v) cosp(i);
  cout << endl;
}
template <typename T>
void coVec(const Vec1<T> &v) {
  for (T i : v) cosp(i);
  cout << endl;
}
void sonic() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void setp(const ll n) { cout << fixed << setprecision(n); }
const ll INF = 1e9 + 1;
const ll LINF = 1e18 + 1;
const ll MOD = 1e9 + 7;
const ld PI = acos(-1);
const ld EPS = 1e-11;
Vec fac, finv;
ll PowMod(ll a, ll n) {
  if (n == 1) return a;
  if (n % 2 == 0) return PowMod(a * a % MOD, n / 2);
  return a * PowMod(a * a % MOD, n / 2) % MOD;
}
ll combi(ll n, ll k) { return fac[n] * finv[k] % MOD * finv[n - k] % MOD; }
void init(ll n) {
  fac.resize(n + 1);
  fac[0] = 1;
  for (ll(i) = (1); (i) <= (n); ++(i)) fac[i] = (fac[i - 1] * i) % MOD;
  finv.resize(n + 1);
  finv[n] = PowMod(fac[n], MOD - 2);
  for (ll(i) = (n)-1; (i) >= (0); --(i))
    finv[i] = (finv[i + 1] * (i + 1)) % MOD;
  finv[0] = 1;
}
unordered_map<ll, ll> pl, mi;
ll maxp = 0, maxm = 0;
ll fp(ll p, ll d) {
  if (!d) return 1;
  if (p > d || p > maxp) return 0;
  ll r = d / p;
  chmin(r, pl[p]);
  ll res = 0;
  for (ll(i) = (0); (i) < (r + 1); ++(i))
    res += fp(p + 1, d - i * p) * combi(pl[p], i);
  return res;
}
ll fm(ll p, ll d) {
  if (!d) return 1;
  if (p > d || p > maxm) return 0;
  ll r = d / p;
  chmin(r, mi[p]);
  ll res = 0;
  for (ll(i) = (0); (i) < (r + 1); ++(i))
    res += fm(p + 1, d - i * p) * combi(mi[p], i);
  return res;
}
int main(void) {
  ll n, a;
  cin >> n >> a;
  Vec x(n);
  for (ll(i) = (0); (i) < (n); ++(i)) cin >> x[i];
  init(n);
  ll zero = 0, plus = 0, minus = 0;
  for (ll(i) = (0); (i) < (n); ++(i)) {
    ll y = x[i] - a;
    if (y == 0)
      zero++;
    else if (y > 0) {
      pl[y]++;
      plus += y;
      chmax(maxp, y);
    } else {
      mi[-y]++;
      minus -= y;
      chmax(maxm, -y);
    }
  }
  ll ans = 1;
  for (ll(d) = (1); (d) <= (min(plus, minus)); ++(d)) {
    ans += fp(1, d) * fm(1, d);
  }
  ans <<= zero;
  ans--;
  co(ans);
  return 0;
}
