#include <bits/stdc++.h>
namespace {
unsigned long long choose(unsigned long long n, unsigned long long k) {
  static std::map<std::pair<unsigned long long, unsigned long long>,
                  unsigned long long>
      cache;
  auto it = cache.find({n, k});
  if (it != cache.end()) return it->second;
  if (k > n) {
    return 0;
  }
  unsigned long long r = 1;
  for (unsigned long long d = 1; d <= k; ++d) {
    r *= n--;
    r /= d;
  }
  cache.insert({{n, k}, r});
  return r;
}
unsigned long long getMatch(unsigned int *count, int target, int index = 50) {
  static std::map<int, unsigned long long> cache;
  auto it = cache.find(target);
  if (it != cache.end()) return it->second;
  if (target == 0) {
    unsigned long long result = 0;
    for (unsigned int i = 0; i != count[0] + 1; ++i) {
      result += choose(count[0], i);
    }
    return result;
  } else if (index == 0) {
    return 0;
  } else {
    unsigned long long result = 0;
    for (int i = 0; i != count[index] + 1; ++i) {
      result += choose(count[index], i) *
                getMatch(count, target - index * i, index - 1);
    }
    cache.insert({target, result});
    return result;
  }
}
unsigned long long solve(unsigned int *count, int current = 0,
                         int index = -50) {
  if (index == 0) {
    if (current == 0) {
      return 0;
    } else {
      return getMatch(count, -current);
    }
  } else {
    unsigned long long result = 0;
    for (int i = 0; i != count[index] + 1; ++i) {
      result += choose(count[index], i) *
                solve(count, current + index * i, index + 1);
    }
    return result;
  }
}
}  // namespace
int main() {
  unsigned int _count[101] = {};
  unsigned int *count = &_count[50];
  int n, a;
  std::cin >> n >> a;
  for (int i = 0; i != n; ++i) {
    int buf;
    std::cin >> buf;
    ++count[buf - a];
  }
  std::cout << solve(count) + getMatch(count, 0) - 1 << std::endl;
  return 0;
}
