#include <bits/stdc++.h>
using namespace std;
int bit_cnt(long long b) {
  int cnt = 0;
  while (b != 0) {
    cnt += (b % 2);
    b /= 2;
  }
  return cnt;
}
int x[50];
int L[1 << 25];
map<int, long long> enume(int n, int ofs, int A) {
  map<int, long long> D;
  long long jbit, nbit;
  int nv;
  D[0] += 1;
  for (long long i = 0; i < (1 << n); i++) L[i] = -1;
  L[0] = 0;
  for (long long k = 0; k < (1 << n); k++) {
    for (int j = (0); j < (n); j++) {
      jbit = 1 << j;
      if ((k & jbit) != 0) continue;
      nbit = k + jbit;
      if (L[nbit] != -1) continue;
      nv = L[k] + x[j + ofs];
      L[nbit] = nv;
      D[nv - A * bit_cnt(nbit)] += 1;
    }
  }
  return D;
}
int main() {
  int N, A, n1, n2;
  long long ans = 0;
  map<int, long long> D1, D2;
  map<int, long long>::iterator it;
  scanf("%d %d", &N, &A);
  for (int i = (0); i < (N); i++) scanf("%d", x + i);
  n1 = N / 2;
  n2 = N - n1;
  D1 = enume(n1, 0, A);
  D2 = enume(n2, n1, A);
  for (it = D1.begin(); it != D1.end(); it++) {
    ans += it->second * D2[-(it->first)];
  }
  printf("%lld", ans - 1);
  return 0;
}
