#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <typename T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
template <typename T = ll>
inline T in() {
  T ret;
  cin >> ret;
  return ret;
}
ll n, a;
void get_sum(const vector<ll>& src, vector<ll>& dst, ll depthnow = 0,
             ll sum = 0, ll cnt = 0) {
  if (depthnow == src.size()) {
    dst.push_back(sum - a * cnt);
  } else {
    get_sum(src, dst, depthnow + 1, sum, cnt);
    get_sum(src, dst, depthnow + 1, sum + src[depthnow], cnt + 1);
  }
}
int main() {
  n = in();
  a = in();
  if (n == 1) {
    cout << (in() == a ? 1 : 0) << endl;
  } else {
    vector<ll> x1(n / 2), x2(n - n / 2);
    for (ll i = 0, i_len = (n / 2); i < i_len; ++i) x1[i] = in();
    for (ll i = 0, i_len = (n - n / 2); i < i_len; ++i) x2[i] = in();
    vector<ll> v1, v2;
    v1.reserve(1 << x1.size());
    get_sum(x1, v1);
    v2.reserve(1 << x2.size());
    get_sum(x2, v2);
    vector<ll> v2cnt(6000, 0);
    for (auto v : v2) ++v2cnt[v + 2500];
    ll ans = 0;
    for (auto v : v1) ans += v2cnt[-v + 2500];
    cout << ans - 1 << endl;
  }
}
