#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  if (a == 0) {
    return b;
  }
  return a / gcd(a, b) * b;
}
long long x[50];
vector<pair<long long, long long> > ve_fir, ve_sec;
map<pair<long long, long long>, long long> mp;
signed main() {
  long long n, a;
  cin >> n >> a;
  for (long long i = 0; i < n; i++) cin >> x[i];
  long long mid = n / 2;
  for (long long i = 0; i < (1 << mid); i++) {
    long long sum = 0, cnt = 0;
    for (long long j = 0; j < mid; j++) {
      if (i & (1 << j)) {
        sum += x[j];
        cnt++;
      }
    }
    ve_fir.push_back(make_pair(cnt, sum));
  }
  for (long long i = 0; i < (1 << (n - mid)); i++) {
    pair<long long, long long> p = make_pair(0, 0);
    for (long long j = 0; j < n - mid; j++) {
      if (i & (1 << j)) {
        p.second += x[j + mid];
        p.first++;
      }
    }
    mp[p]++;
  }
  long long ans = 0;
  for (long long i = 0; i < ve_fir.size(); i++) {
    long long cnt = ve_fir[i].first, sum = ve_fir[i].second;
    for (long long j = 0; j <= n; j++) {
      if (cnt == 0 && j == 0) continue;
      long long need = (cnt + j) * a;
      ans += mp[make_pair(j, need - sum)];
    }
  }
  cout << ans << endl;
}
