#include <bits/stdc++.h>
using namespace std;
long long N, A;
void dfs(long long now, long long sum, long long num_used, vector<long long>& x,
         map<long long, long long>& num) {
  if (now == x.size() - 1) {
    num[A * num_used - sum] += 1;
    num[A * (num_used + 1) - (sum + x.at(x.size() - 1))] += 1;
  } else {
    dfs(now + 1, sum, num_used, x, num);
    dfs(now + 1, sum + x.at(now), num_used + 1, x, num);
  }
}
int main() {
  cin >> N >> A;
  vector<long long> x1(N / 2), x2(N - N / 2);
  for (long long i = 0; i < N / 2; ++i) {
    cin >> x1.at(i);
  }
  for (long long i = 0; i < (N - N / 2); ++i) {
    cin >> x2.at(i);
  }
  map<long long, long long> num1, num2;
  dfs(0, 0, 0, x1, num1);
  dfs(0, 0, 0, x2, num2);
  long long ans = 0;
  for (const auto& [key, value] : num1) {
    ans += value * num2[-key];
  }
  ans -= 1;
  cout << ans << "\n";
}
