#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void gn(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
template <typename T>
inline void gt(T x) {
  if (!x) return;
  gt(x / 10);
  putchar(x % 10 + '0');
}
const long long N = 1e6 + 5;
struct NODE {
  long long i, r, c, num;
} tt, ss;
long long t, n, m, q, ans;
long long MOD = 1e9 + 7, inf = 0x1f1f1f1f;
double eps = 1e-5;
map<long long, long long> ma;
long long a[55];
int main() {
  long long i, j, k, l, ca = 0, u, v, tmp;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  if (n > 17) return 0 * puts("0");
  for (i = 1; i <= (1 << n); i++) {
    k = l = 0;
    for (j = 1; j <= n; j++) {
      if (i & (1 << j >> 1)) {
        l++;
        k += a[j];
      }
    }
    if (l * m == k && k) ans++;
  }
  cout << ans << endl;
  return 0;
}
