#include <bits/stdc++.h>
using namespace std;
const int MAXN = 53;
inline int R() {
  int rt = 0;
  bool isn = false;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar()) isn = ch == '-' ? true : isn;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) rt = rt * 10 + ch - '0';
  return isn ? -rt : rt;
}
long long dp[MAXN][MAXN][MAXN * MAXN];
int main() {
  freopen("test.in", "r", stdin);
  int n = R(), a = R(), lm = 0;
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    int na = R();
    lm += na;
    for (int j = 0; j <= i; ++j)
      for (int k = 0; k <= lm; ++k) dp[i][j][k] = dp[i - 1][j][k];
    for (int j = 1; j <= i; ++j)
      for (int k = na; k <= lm; ++k) dp[i][j][k] += dp[i - 1][j - 1][k - na];
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) ans += dp[n][i][a * i];
  printf("%lld\n", ans);
  return 0;
}
