#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, x[50], dp[51][51][2600] = {}, ans = 0;
  dp[0][0][0] = 1;
  scanf("%d %d", &n, &a);
  for (int i = 0; i < n; i++) scanf("%d", &x[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k <= 2500; k++)
        if (dp[i][j][k]) {
          dp[i + 1][j][k] += dp[i][j][k];
          dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
        }
  for (int i = 1; i <= n; i++)
    if (dp[n][i][a * i]) {
      ans += dp[n][i][a * i];
    }
  printf("%d\n", ans);
}
