#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
ll dp[51][51][51 * 51];
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N, A;
  cin >> N >> A;
  vector<ll> cards(N);
  for (auto&& c : cards) {
    cin >> c;
  }
  dp[0][0][0] = 1;
  for (ll j = 1; j <= N; j++) {
    ll c = cards[j - 1];
    for (ll k = 0; k <= j; k++) {
      for (ll s = 0; s <= N * 50; s++) {
        if (s < c) {
          dp[j][k][s] = dp[j - 1][k][s];
        } else {
          dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - c];
        }
      }
    }
  }
  ll ans = 0;
  for (ll k = 1; k <= N; k++) {
    ans += dp[N][k][k * A];
  }
  cout << ans << endl;
  return 0;
}
