#include <bits/stdc++.h>
using namespace std;
template <class T, class T2>
inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2>
inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const long long mod = 1e9 + 7;
template <class T>
inline void fix(T &x) {
  if (x >= mod | x <= -mod) {
    x %= mod;
  }
  if (x < 0) {
    x += mod;
  }
}
const int MAX_N = 51;
long long dp[MAX_N][MAX_N][MAX_N * MAX_N + MAX_N];
long long arr[MAX_N];
signed main() {
  int n, a;
  cin >> n >> a;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  dp[0][0][0] = 1;
  for (int i = 0; i <= n; i++) {
    int curr = i;
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < MAX_N * MAX_N; k++) {
        if (dp[curr][j][k] == 0) {
          continue;
        }
        dp[curr + 1][j][k] += dp[curr][j][k];
        dp[curr + 1][j + 1][k + arr[i]] += dp[curr][j][k];
      }
    }
  }
  long long cnt = 0;
  for (int i = 1; i <= n; i++) {
    cnt += dp[n][i][i * a];
  }
  cout << cnt << "\n";
  return 0;
}
