#include <bits/stdc++.h>
using namespace std;
int n, A;
int a[105];
long long f[105][105 * 105];
int main() {
  scanf("%d %d", &n, &A);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), a[i] -= A;
  f[0][A * n] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = -A * n; j <= A * n; ++j) {
      int k = j - a[i] + A * n;
      if (k < 0 || k > 2 * A * n) continue;
      f[i][j + A * n] = f[i - 1][j + A * n] + f[i - 1][k];
    }
  }
  cout << f[n][A * n] - 1 << '\n';
  return 0;
}
