#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const ll LLINF = 1LL << 60;
int dp[50 + 1][50 + 1][2501];
int main() {
  int N, A;
  cin >> N >> A;
  int a[N];
  for (int i = 0; i < (int)(N); i++) cin >> a[i];
  for (int i = 0; i < (int)(N + 1); i++) dp[i][0][0] = 1;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      for (int k = 0; k <= 2500; ++k) {
        dp[i + 1][j + 1][k] = dp[i][j + 1][k];
        if (k >= a[i]) {
          dp[i + 1][j + 1][k] += dp[i][j][k - a[i]];
        }
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i < (int)(N); i++) {
    ans += dp[N][i + 1][A * (i + 1)];
  }
  cout << ans << endl;
}
