#include <bits/stdc++.h>
using namespace std;
template <typename T>
static ostream& operator<<(ostream& stream, const vector<T>& t);
template <typename T>
static istream& read(T, T, istream& = cin);
template <typename T>
static istream& operator>>(istream& stream, vector<T>& t) {
  return read((t).begin(), (t).end(), stream);
}
template <typename T>
static istream& read(T b, T e, istream& stream) {
  for (T it = b; it != e; ++it) stream >> *it;
  return stream;
}
template <typename T>
static void print(T x, string end = "\n") {
  cout << x << end;
}
const int N = 51;
long long dp[N][N * N][N];
void _() {
  int n, a;
  cin >> n >> a;
  vector<int> arr(n);
  cin >> arr;
  dp[0][0][0] = 1;
  for (int i = 0; i < n; ++i)
    for (int sum = 0; sum < N * N; ++sum) {
      for (int cnt = 0; cnt <= i; ++cnt) {
        dp[i + 1][sum + arr[i]][cnt + 1] += dp[i][sum][cnt];
        dp[i + 1][sum][cnt] += dp[i][sum][cnt];
      }
    }
  long long ans = 0;
  for (int sum = 0; sum < N * N; ++sum)
    for (int cnt = 0; cnt < N; ++cnt)
      if (cnt * a == sum) ans += dp[n][sum][cnt];
  print(ans - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);
  _();
}
