#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<vector<T>>;
template <typename T>
using VVV = vector<vector<vector<T>>>;
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;
struct HashPair {
  static size_t m_hash_pair_random;
  template <class T1, class T2>
  size_t operator()(const pair<T1, T2> &p) const {
    auto hash1 = hash<T1>{}(p.first);
    auto hash2 = hash<T2>{}(p.second);
    size_t seed = 0;
    seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    seed ^= m_hash_pair_random + 0x9e3779b9 + (seed << 6) + (seed >> 2);
    return seed;
  }
};
size_t HashPair::m_hash_pair_random = (size_t)random_device()();
void solve() {
  int N, A;
  cin >> N >> A;
  vector<int> X(N);
  for (auto &&it : X) {
    cin >> it;
  }
  unordered_map<pair<int, int>, int, HashPair> s1;
  unordered_map<pair<int, int>, int, HashPair> s2;
  int N1 = N / 2;
  int N2 = N - N1;
  for (int x = 0; x < int(int(pow(2, N1))); x++) {
    int sum = 0, cnt = 0;
    for (int i = 0; i < int(N1); i++) {
      if ((x >> i) & 1) {
        sum += X[i];
        cnt += 1;
      }
    }
    s1[pair<int, int>{cnt, sum}] += 1;
  }
  for (int x = 0; x < int(int(pow(2, N2))); x++) {
    int sum = 0, cnt = 0;
    for (int i = 0; i < int(N2); i++) {
      if ((x >> i) & 1) {
        sum += X[N1 + i];
        cnt += 1;
      }
    }
    s2[pair<int, int>{cnt, sum}] += 1;
  }
  lint ans = 0;
  for (auto &&it : s1) {
    int cnt = it.first.first;
    int sum = it.first.second;
    for (int i = 0; i < int(N - cnt + 1); i++) {
      if (cnt + i == 0) {
        continue;
      }
      int s2_sum = A * (cnt + i) - sum;
      if (s2.count(pair<int, int>{i, s2_sum}) > 0) {
        ans += it.second * s2[pair<int, int>{i, s2_sum}];
      }
    }
  }
  cout << ans << "\n";
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  solve();
}
