#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[100001];
long long sum;
long long dem;
long long B;
long long res;
void input() {
  cin >> n >> B;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
}
void solve() {
  res = 0;
  for (long long x = 1; x <= (1 << n) - 1; x++) {
    sum = 0;
    dem = 0;
    for (long long i = 0; i <= n - 1; i++) {
      if ((x & (1 << i))) {
        sum = sum + a[i];
        dem++;
      }
    }
    if (dem * B == sum) {
      res++;
    }
  }
}
void output() { cout << res; }
signed main() {
  input();
  solve();
  output();
  return 0;
}
