#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LINF = 1ll * INF * INF;
const int MAX_N = 55;
int N, A;
ll Dy[MAX_N][MAX_N][MAX_N * 2];
int main() {
  cin >> N >> A;
  Dy[0][0][0] = 1;
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &x);
    for (int j = 0; j < i; j++)
      for (int k = 0; k <= MAX_N * j; k++) {
        Dy[i][j][k] += Dy[i - 1][j][k];
        Dy[i][j + 1][k + x] += Dy[i - 1][j][k];
      }
  }
  ll ans = 0;
  for (int i = 1; i <= N; i++) ans += Dy[N][i][A * i];
  cout << ans << endl;
  return 0;
}
