#include <bits/stdc++.h>
using namespace std;
int N, A;
int x[50 + 1];
int dp[50 + 1][50 + 1][50 * 50 + 1];
int main(void) {
  cin >> N >> A;
  for (int i = 1; i <= N; ++i) {
    cin >> x[i];
  }
  for (int j = 0; j <= N; ++j) {
    for (int k = 0; k <= N; ++k) {
      for (int s = 0; s <= N * 50; ++s) {
        if (j == 0 && k == 0 && s == 0) {
          dp[j][k][s] = 1;
        } else if (j >= 1 && s < x[j]) {
          dp[j][k][s] = dp[j - 1][k][s];
        } else if (j >= 1 && k >= 1 && s >= x[j]) {
          dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j]];
        } else {
          dp[j][k][s] = 0;
        }
      }
    }
  }
  long long num = 0;
  for (int k = 1; k <= N; ++k) {
    num += dp[N][k][k * A];
  }
  cout << num << endl;
  return 0;
}
