#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
template <class T = int>
T __rand(T range = numeric_limits<T>::max()) {
  return (T)(rng() % range);
}
template <class T>
ostream& operator,(ostream& out, const T& thing) {
  return out << ", " << thing;
}
template <class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& p) {
  return (out << "(" << p.first, p.second) << ")";
}
template <class A, class B>
ostream& operator<<(ostream& out, const tuple<A, B>& t) {
  return (out << "(" << get<0>(t), get<1>(t)) << ")";
}
template <class A, class B, class C>
ostream& operator<<(ostream& out, const tuple<A, B, C>& t) {
  return (out << "(" << get<0>(t), get<1>(t), get<2>(t)) << ")";
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& container) {
  out << "{";
  if (((int)container.size())) out << container[0];
  for (int i = 0; i++ < ((int)container.size()) - 1;) out, container[i];
  return out << "}";
}
template <class x>
vector<typename x::value_type> $v(const x& a) {
  return vector<typename x::value_type>(a.begin(), a.end());
}
template <class u>
vector<typename iterator_traits<u>::value_type> $v(u a, u b) {
  return vector<typename iterator_traits<u>::value_type>(a, b);
}
const int maxn = 51;
int n, a, x[maxn];
long long dp[2][maxn][maxn * maxn];
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a;
  for (int i = 0; i++ < n;) cin >> x[i];
  int total = accumulate(x, x + n, 0);
  dp[0][0][0] = 1;
  for (int i = 0; i++ < n;) {
    int state = i & 1;
    memcpy(dp[state], dp[!state], sizeof(dp[state]));
    for (int cnt = -1; ++cnt < n;)
      for (int sum = -1; ++sum < total + 1 - x[i];) {
        long long& cur = dp[state][cnt + 1][sum + x[i]];
        cur += dp[!state][cnt][sum];
      }
  }
  long long ans = -1;
  for (int cnt = -1; ++cnt < n + 1;) {
    int s = cnt * a;
    ans += dp[n & 1][cnt][s];
  }
  cout << ans;
  return 0;
}
