#include <bits/stdc++.h>
using namespace std;
int n, a, x[50];
long long dp[51][2501] = {};
int main(void) {
  cin >> n >> a;
  for (int i = 0; i != n; i++) {
    cin >> x[i];
    x[i] -= a;
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= 2500; j++) {
      if (i == 0 && j == 0) {
        dp[i][j] = 1;
      } else if (i == 0) {
        dp[i][j] = 0;
      } else if (j - a < 0 && j - x[i - 1] - a < 0) {
        dp[i][j] = 0;
      } else if (j - x[i - 1] - a < 0) {
        dp[i][j] = dp[i - 1][j - a];
      } else {
        dp[i][j] = dp[i - 1][j - a] + dp[i - 1][j - x[i - 1] - a];
      }
    }
  }
  cout << dp[n][n * a] - 1 << endl;
  return 0;
}
