#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline void dump(vector<T> v) {
  for (auto& x : v) cerr << x << " ";
  cerr << endl;
}
template <class T>
inline void dump(vector<pair<T, T>> v) {
  for (auto& p : v) cerr << p.first << " " << p.second << endl;
}
template <class T>
inline void dump(vector<vector<T>> vv) {
  for (auto& v : vv) {
    for (auto& x : v) cerr << x << " ";
    cerr << endl;
  }
}
constexpr int INF = 1e9 + 5;
constexpr long long INFLL = 1LL << 60;
constexpr double eps = (1e-9);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a;
  cin >> n >> a;
  vector<int> x(n);
  for (int i = 0; i < (n); ++i) cin >> x[i];
  map<int, ll> f, s;
  for (int i = 0; i < (1 << (n / 2)); i++) {
    int sum = 0;
    int num = 0;
    for (int j = 0; j < (n / 2); j++) {
      if ((i >> j) & 1) {
        sum += x[j];
        num++;
      }
    }
    int x = sum - a * num;
    f[x]++;
  }
  for (int i = 0; i < (1 << (n - n / 2)); i++) {
    int sum = 0;
    int num = 0;
    for (int j = 0; j < n - (n / 2); j++) {
      if (j >= n) break;
      if ((i >> j) & 1) {
        sum += x[j + (n / 2)];
        num++;
      }
    }
    int x = sum - a * num;
    s[x]++;
  }
  ll ans = 0;
  for (auto& p : f) {
    ans += p.second * s[-p.first];
  }
  cout << ans - 1 << endl;
  return 0;
}
