#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000;
int dp[maxn][50 * 500];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int sum = 0;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    sum += x;
    for (int j = i; j >= 1; j--) {
      for (int s = sum; s >= x; s--) dp[j][s] += dp[j - 1][s - x];
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += dp[i][i * k];
  printf("%lld\n", ans);
}
