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