#include <bits/stdc++.h>
using namespace std;
const int maxn = 50 + 5;
const int maxm = 5000 + 5;
const long long mo = 1e9 + 7;
int n, m, k;
int a[maxn];
int ans, tmp, cnt;
int dp[maxn][2510];
char s[maxn];
long long power(long long a, long long n) {
  long long sum = 1;
  while (n) {
    if (n & 1) sum = sum * a % mo;
    n >>= 1;
    a = a * a % mo;
  }
  return sum;
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    int sum = 0;
    for (register long long i = (1); i <= (n); i++) {
      scanf("%d", &a[i]);
      sum += a[i];
    }
    memset(dp, -1, sizeof(dp));
    dp[0][0] = 1;
    for (register long long i = (1); i <= (n); i++) {
      for (register long long k = (i - 1); k >= (0); k--)
        for (register long long j = (sum); j >= (a[i]); j--)
          if (dp[k][j - a[i]] != -1) {
            dp[k + 1][j] = max(dp[k + 1][j], 0);
            dp[k + 1][j] += dp[k][j - a[i]];
          }
    }
    long long ans = 0;
    for (register long long i = (1); i <= (n); i++)
      if (i * m <= sum && dp[i][i * m] > 0) {
        ans += dp[i][i * m];
      }
    printf("%lld\n", ans);
  }
  return 0;
}
