#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007, mod9 = 1000000009;
template <class T>
inline T lcm(T a, T b) {
  return (a * b / __gcd(a, b));
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, sum = 0;
  cin >> n >> a;
  int x[n];
  long long dp[55][55][3000];
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    sum += x[i];
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k <= sum; k++) {
        dp[i + 1][j][k] += dp[i][j][k];
        dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dp[n][i][i * a];
  }
  cout << ans - 1 << endl;
  return 0;
}
