#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
void file() {}
int tc;
const int N = 5e5 + 5, M = 2e6 + 5, MOD = 1e9 + 7, OO = 1e9;
const int MSQ = sqrt(N) + 5;
std::vector<int> wa;
int a[55];
bool y[1000005];
void sieve() {
  for (int i = 2; i <= 1000000; i++) {
    if (y[i]) continue;
    wa.push_back(i);
    for (int j = i; j <= 1000000; j += i) {
      y[j] = 1;
    }
  }
}
int cnt[55][5500];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  long long ans = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < 1 << (n / 2); i++) {
    int sum = 0;
    int sz = 0;
    for (int bit = 0; (1 << bit) <= i; bit++)
      if ((1 << bit) & i) sum += a[bit], sz++;
    cnt[sz][sum]++;
    if (sum == sz * k && sum) ans++;
  }
  for (int i = 1; i < (1 << (n + 1) / 2); i++) {
    int sum = 0;
    int sz = 0;
    for (int bit = 0; (1 << bit) <= i; bit++) {
      if ((1 << bit) & i) sum += a[n / 2 + bit], sz++;
    }
    for (int i = 0; i <= n / 2; i++) {
      int need = (sz + i) * k - sum;
      if (need >= 0) ans += cnt[i][need];
    }
  }
  printf("%lld\n", ans);
}
