#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;
}
int main() {
  ll 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());
    v2.reserve(1 << x2.size());
    for (ll i = 0, i_len = (1 << x1.size()); i < i_len; ++i) {
      ll sum = 0, cnt = 0;
      for (ll j = 0; (i >> j); ++j) {
        if ((i >> j) & 1) {
          sum += x1[j];
          ++cnt;
        }
      }
      v1.push_back(sum - a * cnt);
    }
    for (ll i = 0, i_len = (1 << x2.size()); i < i_len; ++i) {
      ll sum = 0, cnt = 0;
      for (ll j = 0; (i >> j); ++j) {
        if ((i >> j) & 1) {
          sum += x2[j];
          ++cnt;
        }
      }
      v2.push_back(a * cnt - sum);
    }
    vector<ll> v2cnt(3000, 0);
    for (auto v : v2) ++v2cnt[v];
    ll ans = 0;
    for (auto v : v1) ans += v2cnt[v];
    cout << ans - 1 << endl;
  }
}
