#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A;
  scanf("%d %d\n", &N, &A);
  int zero = 0;
  vector<int> plus;
  vector<int> minus;
  for (int i = 0; i < N; ++i) {
    int x;
    scanf("%d", &x);
    getchar();
    x -= A;
    if (x == 0) {
      ++zero;
    } else if (x > 0) {
      plus.emplace_back(x);
    } else {
      minus.emplace_back(x);
    }
  }
  if (zero == 0 && (plus.size() == 0 || minus.size() == 0)) {
    puts("0");
    return 0;
  }
  unordered_map<int, int> minus_count;
  function<void(int, int)> searchMinus = [&](int sum, int i) {
    if (i == minus.size()) {
      if (minus_count.count(sum)) {
        ++minus_count[sum];
      } else {
        minus_count[sum] = 1;
      }
      return;
    }
    searchMinus(sum, i + 1);
    searchMinus(sum + minus[i], i + 1);
  };
  searchMinus(0, 0);
  unordered_map<int, int> plus_count;
  function<void(int, int)> searchPlus = [&](int sum, int i) {
    if (i == plus.size()) {
      if (plus_count.count(sum)) {
        ++plus_count[sum];
      } else {
        plus_count[sum] = 1;
      }
      return;
    }
    searchPlus(sum, i + 1);
    searchPlus(sum + plus[i], i + 1);
  };
  searchPlus(0, 0);
  long long result = 0;
  if (plus_count.size() <= minus_count.size()) {
    for (auto& num : plus_count) {
      if (minus_count.count(-num.first))
        result += num.second * minus_count[-num.first];
    }
  } else {
    for (auto& num : minus_count) {
      if (plus_count.count(-num.first))
        result += num.second * plus_count[-num.first];
    }
  }
  result <<= zero;
  --result;
  printf("%lld\n", result);
}
