#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &A) {
  for (long long i = 0; i < A.size(); i++) os << A[i] << " ";
  os << endl;
  return os;
}
template <>
ostream &operator<<(ostream &os, const vector<vector<long long> > &A) {
  long long N = A.size();
  long long M;
  if (N > 0) M = A[0].size();
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < M; j++) os << A[i][j] << " ";
    os << endl;
  }
  return os;
}
struct edge {
  long long from, to, d, c;
  edge(long long _from = 0, long long _to = 0, long long _d = 0,
       long long _c = 0) {
    from = _from;
    to = _to;
    d = _d;
    c = _c;
  }
  bool operator<(const edge &rhs) const {
    return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
  }
};
struct flow {
  long long to, cap, rev, cost;
  flow(long long to = 0, long long cap = 0, long long rev = 0,
       long long cost = 0)
      : to(to), cap(cap), rev(rev), cost(cost) {}
};
const long long di[4] = {0, -1, 0, 1};
const long long dj[4] = {-1, 0, 1, 0};
const long long ci[5] = {0, 0, -1, 0, 1};
const long long cj[5] = {0, -1, 0, 1, 0};
const long long LINF = LLONG_MAX / 2;
const long long INF = INT_MAX / 2;
const double PI = acos(-1);
template <typename T, typename U>
bool chmin(T &x, const U &y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template <typename T, typename U>
bool chmax(T &x, const U &y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
struct initializer {
  initializer() { cout << fixed << setprecision(11); }
};
initializer _____;
long long N, M, K, T, Q;
signed main() {
  long long N, A;
  cin >> N >> A;
  vector<long long> X1(N), X2(N);
  long long N1 = N / 2, N2 = N - N1;
  for (long long i = 0; i < (long long)(N1); i++) cin >> X1[i];
  for (long long i = 0; i < (long long)(N2); i++) cin >> X2[i];
  vector<long long> S1((1 << N1) - 1), S2((1 << N2) - 1);
  long long ans = 0;
  for (long long bit = 1; bit < (1 << N1); bit++) {
    long long s = 0;
    long long tmp = 0;
    for (long long i = 0; i < (long long)(N1); i++) {
      if (bit & (1 << i)) {
        s++;
        tmp += X1[i];
      }
    }
    tmp -= A * s;
    S1[bit - 1] = tmp;
    if (tmp == 0) ans++;
  }
  for (long long bit = 1; bit < (1 << N2); bit++) {
    long long s = 0;
    long long tmp = 0;
    for (long long i = 0; i < (long long)(N2); i++) {
      if (bit & (1 << i)) {
        s++;
        tmp += X2[i];
      }
    }
    tmp -= A * s;
    S2[bit - 1] = tmp;
    if (tmp == 0) ans++;
  }
  sort(S1.begin(), S1.end());
  sort(S2.begin(), S2.end());
  for (long long i = 0; i < S1.size(); i++) {
    long long tmp = -S1[i];
    ans += upper_bound(S2.begin(), S2.end(), tmp) -
           lower_bound(S2.begin(), S2.end(), tmp);
  }
  cout << ans << endl;
  return 0;
}
