#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
void print(vector<int> v) {
  for (auto e : v) cout << e << " ";
  cout << "\n";
}
void print(vector<long long> v) {
  for (auto e : v) cout << e << " ";
  cout << "\n";
}
void print(map<int, int> mp) {
  for (auto e : mp) cout << e.first << " " << e.second << "\n";
  cout << "\n";
}
const long long MOD = 1e9 + 7;
const int N = 500000;
int main() {
  int n = in();
  int a = in();
  vector<int> v;
  for (long long i = 0; i < n / 2; i++) v.push_back(in() - a);
  map<int, long long> mp;
  for (long long i = 0; i < 1 << (n / 2); i++) {
    int now = 0;
    for (long long j = 0; j < n / 2; j++) {
      if (i & (1 << j)) {
        now += v[j];
      }
    }
    mp[now]++;
  }
  vector<int> w;
  n = n - n / 2;
  long long ans = 0;
  for (long long i = 0; i < n; i++) w.push_back(a - in());
  for (long long i = 0; i < 1 << n; i++) {
    int now = 0;
    for (long long j = 0; j < n; j++) {
      if (i & (1 << j)) {
        now += w[j];
      }
    }
    ans += mp[now];
  }
  cout << ans - 1;
}
