#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][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]);
  for (int l = (0), loop_end_l = (2); l < (loop_end_l); l++) {
    int p[2];
    p[0] = v[l].size() / 2;
    p[1] = v[l].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[l][j + k * p[0]];
          }
        }
        u[l][k].push_back(sm);
      }
      if (k == 1)
        sort((u[l][k]).begin(), (u[l][k]).end());
      else
        sort((u[l][k]).begin(), (u[l][k]).end(), greater<int>());
    }
  }
  long long ans = 0;
  long long buf[2];
  for (int i = (0), loop_end_i = (3000); i < (loop_end_i); i++) {
    buf[0] = buf[1] = 0;
    for (int k = (0), loop_end_k = (2); k < (loop_end_k); k++) {
      int ub = 0, lb = 0;
      int nn = u[k][1].size();
      for (int j : u[k][0]) {
        long long ano = i - j;
        while (ub < nn && u[k][1][ub] <= ano) ub++;
        while (lb < nn && u[k][1][lb] < ano) lb++;
        long long c = ub - lb;
        buf[k] += c;
      }
    }
    ans += buf[0] * buf[1];
  }
  for (int i = (0), loop_end_i = (zer); i < (loop_end_i); i++) ans *= 2;
  printf("%lld\n", ans - 1);
}
