#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline istream& operator>>(istream& i, vector<T>& v) {
  for (int j = 0; j < ((int)(v).size()); ++j) i >> v[j];
  return i;
}
template <typename T1, typename T2>
inline istream& operator>>(istream& i, pair<T1, T2>& v) {
  return i >> v.first >> v.second;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
long long INF = 1001001001;
long long LINF = 1001001001001001001ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, a;
  cin >> n >> a;
  vector<long long> xs(n);
  cin >> xs;
  vector<vector<long long> > dp(n + 1, vector<long long>(2510));
  dp[0][0] = 1;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j)
      for (int k = 0; k < (2500); ++k) {
        if (k + xs[i] < 2500) dp[n - j][k + xs[i]] += dp[n - j - 1][k];
      }
  long long ans = 0;
  for (int i = 0; i < (n - 1); ++i) {
    ans += dp[i + 1][a * (i + 1)];
  }
  cout << ans << endl;
}
