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