#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const long long LLINF = 1000000000000000005LL;
;
const long long MOD = (long long)(1e9) + 7;
void _mod(long long& x) { x = ((((x) % (MOD)) + (MOD)) % (MOD)); }
const double EPS = 1e-10;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
  std::fill((T*)array, (T*)(array + N), val);
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T> V) {
  for (auto v : V) os << v << " ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T> V) {
  for (auto v : V) os << v << " ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const deque<T> V) {
  for (auto v : V) os << v << " ";
  return os;
}
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
class CTakAndCards {
 public:
  int dp[55][3000];
  int Arr[55];
  int N, A;
  void solve(std::istream& cin, std::ostream& cout, std::ostream& cerr) {
    cin >> N >> A;
    Fill(dp, 0);
    for (__typeof(N) i = 0, _len = (N); i < (_len); i += 1) cin >> Arr[i];
    dp[0][0] = 1;
    for (__typeof(N) n = 0, _len = (N); n < (_len); n += 1)
      for (__typeof(0) end = 0, begin = N + 1,
                       cnt = (begin) - ((begin) > (end));
           cnt != (end) - ((begin) > (end)); cnt += 1 - 2 * ((begin) > (end)))
        for (__typeof(Arr[n]) end = Arr[n], begin = 3000,
                              sum = (begin) - ((begin) > (end));
             sum != (end) - ((begin) > (end));
             sum += 1 - 2 * ((begin) > (end))) {
          dp[cnt + 1][sum] += dp[cnt][sum - Arr[n]];
        }
    long long sum = 0;
    for (__typeof(N + 1) end = N + 1, begin = 1,
                         i = (begin) - ((begin) > (end));
         i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
      sum += dp[i][i * A];
    cout << sum << endl;
  }
};
int main() {
  CTakAndCards solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  std::ostringstream err;
  in.tie(0);
  ios::sync_with_stdio(0);
  solver.solve(in, out, err);
  return 0;
}
