#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, A;
  cin >> N >> A;
  vector<int> x(N);
  vector<int> plus, minus;
  ll zero = 0;
  for (int i = 0; i < N; i++) {
    cin >> x.at(i);
    x.at(i) -= A;
    if (x.at(i) > 0) {
      plus.push_back(x.at(i));
    } else if (x.at(i) < 0) {
      minus.push_back(-x.at(i));
    } else {
      zero++;
    }
  }
  sort(plus.begin(), plus.end());
  sort(minus.begin(), minus.end());
  vector<ll> dp1(5001, -1), dp2(5001, -1);
  dp1.at(0) = 0;
  dp2.at(0) = 0;
  for (int i = 0; i < plus.size(); i++) {
    for (int j = 5000; j >= 0; j--) {
      if (j - plus.at(i) < 0) {
        break;
      }
      if (dp1.at(j - plus.at(i)) != -1) {
        if (dp1.at(j) == -1) {
          dp1.at(j) = 1;
        } else {
          dp1.at(j)++;
        }
      }
    }
  }
  for (int i = 0; i < minus.size(); i++) {
    for (int j = 5000; j >= 0; j--) {
      if (j - minus.at(i) < 0) {
        break;
      }
      if (dp2.at(j - minus.at(i)) != -1) {
        if (dp2.at(j) == -1) {
          dp2.at(j) = 1;
        } else {
          dp2.at(j)++;
        }
      }
    }
  }
  ll sum = 0;
  for (int i = 0; i < 5000; i++) {
    sum += max<ll>(dp1.at(i), 0) * max<ll>(dp2.at(i), 0);
  }
  if (zero == 0) {
    cout << sum << endl;
  } else {
    cout << (1ull << zero) * (sum + 1) - 1 << endl;
  }
}
