#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 2147483647;
constexpr long long INFF = 9223372036854775807;
long long dp[60][60][2600];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A;
  cin >> N >> A;
  int X[N];
  for (long long i = 0; i < N; ++i) cin >> X[i];
  dp[0][0][0] = 1;
  for (long long i = 0; i < N; ++i)
    for (long long j = 0; j < N; ++j)
      for (long long k = 0; k < 2600; ++k) {
        if (dp[i][j][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 (long long i = 1; i < N; ++i) ans += dp[N][i][i * A];
  cout << ans << endl;
}
