#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
vector<ll> bitSearch(int bit, int n) {
  vector<ll> S;
  for (int i = 0; (i) < (int)(n); i++)
    if (bit & (1 << i)) S.push_back(i);
  S.push_back(1e9);
  return S;
}
int main() {
  ll n, a;
  cin >> n >> a;
  int xm = min((ll)20, n / 2);
  int ym = n - xm;
  vector<ll> x(xm), y(ym);
  for (int i = 0; (i) < (int)(xm); i++) cin >> x[i];
  for (int i = 0; (i) < (int)(ym); i++) cin >> y[i];
  ll res = 0;
  int xs = x.size(), ys = y.size();
  vector<vector<ll>> bit0(n + 1), bit1(n + 1);
  for (ll bit = 0; bit < (1 << xs); bit++) {
    auto S = bitSearch(bit, xs);
    int sz = S.size() - 1;
    ll sum = 0;
    for (auto s : S) {
      if (s == 1e9) break;
      sum += x[s];
    }
    bit0[sz].push_back(sum);
  }
  for (ll bit = 0; bit < (1 << ys); bit++) {
    auto S = bitSearch(bit, ys);
    int sz = S.size() - 1;
    ll sum = 0;
    for (auto s : S) {
      if (s == 1e9) break;
      sum += y[s];
    }
    bit1[sz].push_back(sum);
  }
  for (int i = 0; (i) < (int)(n + 1); i++) {
    sort((bit0[i]).begin(), (bit0[i]).end());
    sort((bit1[i]).begin(), (bit1[i]).end());
    bit1[i].push_back(1e9);
  }
  for (int i = 0; (i) < (int)(n + 1); i++) {
    int sz = bit0[i].size();
    for (int j = 0; (j) < (int)(sz); j++) {
      for (int k = 0; (k) < (int)(n + 1); k++) {
        ll rem = (ll)(a * (i + k)) - bit0[i][j];
        if (rem < 0) continue;
        ll dif = upper_bound((bit1[k]).begin(), (bit1[k]).end(), rem) -
                 lower_bound((bit1[k]).begin(), (bit1[k]).end(), rem);
        res += dif;
      }
    }
  }
  cout << res << endl;
}
