#include <bits/stdc++.h>
using namespace std;
int dx[8] = {1, 0, 0, -1, 1, 1, -1, -1};
int dy[8] = {0, -1, 1, 0, -1, 1, -1, 1};
vector<int> v[2], u[2];
int main() {
  int n, a;
  scanf("%d", &(n));
  scanf("%d", &(a));
  ;
  int zer = 0;
  for (int i = (0), loop_end_i = (n); i < (loop_end_i); i++) {
    int xx;
    scanf("%d", &(xx));
    ;
    xx -= a;
    if (xx > 0) v[0].push_back(xx);
    if (xx < 0) v[1].push_back(-xx);
    if (xx == 0) zer++;
  }
  if (v[0].size() > v[1].size()) swap(v[0], v[1]);
  long long cnt[3000];
  fill(cnt, cnt + 3000, 0);
  for (int i = (0), loop_end_i = (1 << v[0].size()); i < (loop_end_i); i++) {
    int sm = 0;
    for (int j = (0), loop_end_j = (v[0].size()); j < (loop_end_j); j++) {
      if (i & (1 << j)) {
        sm += v[0][j];
      }
    }
    cnt[sm]++;
  }
  int p[2];
  p[0] = v[1].size() / 2;
  p[1] = v[1].size() - p[0];
  for (int k = (0), loop_end_k = (2); k < (loop_end_k); k++) {
    for (int i = (0), loop_end_i = (1 << p[k]); i < (loop_end_i); i++) {
      int sm = 0;
      for (int j = (0), loop_end_j = (p[k]); j < (loop_end_j); j++) {
        if (i & (1 << j)) {
          sm += v[1][j + k * p[0]];
        }
      }
      u[k].push_back(sm);
    }
    sort((u[k]).begin(), (u[k]).end());
  }
  long long ans = 0;
  for (int i = (0), loop_end_i = (3000); i < (loop_end_i); i++) {
    for (int j : u[0]) {
      int ano = i - j;
      long long c = upper_bound((u[1]).begin(), (u[1]).end(), ano) -
                    lower_bound((u[1]).begin(), (u[1]).end(), ano);
      long long cc = c * cnt[i];
      ans += cc;
    }
  }
  for (int i = (0), loop_end_i = (zer); i < (loop_end_i); i++) ans *= 2;
  printf("%I64d\n", ans - 1);
}
