#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A;
  cin >> N >> A;
  vector<long long> X(N);
  for (int i = (0); i < (N); ++i) cin >> X[i];
  vector<vector<long long>> dp(51, vector<long long>(51 * 51, 0));
  dp[0][0] = 1;
  for (int i = (0); i < (N); ++i) {
    map<pair<long long, long long>, long long> done;
    for (int j = (1); j < (i + 2); ++j) {
      for (int k = (0); k < (50 * 49); ++k) {
        done[make_pair(j, k + X[i])] = dp[j - 1][k];
      }
    }
    for (auto d : done) dp[d.first.first][d.first.second] += d.second;
  }
  long long ret = 0;
  for (int i = (0); i < (N); ++i) {
    ret += dp[i + 1][(i + 1) * A];
  }
  cout << ret << endl;
  return 0;
}
