#include <bits/stdc++.h>
using namespace std;
long long N, A;
int x[50];
int main() {
  cin >> N >> A;
  for (int i = 0; i < N; ++i) cin >> x[i];
  map<int, long long> cnt1[30], cnt2[30];
  for (int i = 0; i < 1 << (N / 2); ++i) {
    int sum = 0, c = 0;
    for (int j = 0; j < N / 2; ++j)
      if ((i >> j) & 1) {
        sum += x[j];
        ++c;
      }
    ++cnt1[c][sum];
  }
  for (int i = 0; i < 1 << (N - N / 2); ++i) {
    int sum = 0, c = 0;
    for (int j = 0; j < N - N / 2; ++j)
      if ((i >> j) & 1) {
        sum += x[j + N / 2];
        ++c;
      }
    ++cnt2[c][sum];
  }
  long long r = 0;
  for (int j = 0; j <= N / 2; ++j)
    for (auto p : cnt1[j]) {
      for (int i = 0; i <= N - N / 2; ++i) {
        int c = i + j;
        int x = A * c - p.first;
        if (c == 0) continue;
        if (cnt2[i].count(x)) r += p.second * cnt2[i][x];
      }
    }
  cout << r << endl;
}
