#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
int dp[55][55][20000];
int N, A;
int x[50];
const int MAX = 510000;
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} aaaaaaa;
int dpp(int basho, int maisu, int gouke) {
  if (basho >= N) {
    if (gouke == maisu * A && maisu != 0) {
      return 1;
    } else {
      return 0;
    }
  }
  if (dp[basho][maisu][gouke] != -1) {
    return dp[basho][maisu][gouke];
  }
  int yes = dpp(basho + 1, maisu + 1, gouke + x[basho]);
  int no = dpp(basho + 1, maisu, gouke);
  dp[basho][maisu][gouke] = yes + no;
  return dp[basho][maisu][gouke];
}
int main() {
  cin >> N >> A;
  for (long long int i = 0; i < N; i++) {
    cin >> x[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << dpp(0, 0, 0) << endl;
  return 0;
}
