#include <bits/stdc++.h>
using namespace std;
const int N = 55;
const long long INF = ~0u >> 2;
long long dp[N][N][N * N], n, a[N], A, ans;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
int main() {
  n = read();
  A = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= i; ++j) {
      for (int k = 0; k <= A * i; ++k) {
        dp[i][j][k] += dp[i - 1][j][k];
        if (k - a[i] >= 0 && j >= 1) dp[i][j][k] += dp[i - 1][j - 1][k - a[i]];
      }
    }
  }
  for (int i = 1; i <= n; ++i) ans += dp[n][i][i * A];
  printf("%lld", ans);
  return 0;
}
