#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &str, vector<T> &a) {
  for (auto &i : a) {
    str << i << " ";
  }
  return str;
}
template <class T>
istream &operator>>(istream &str, vector<T> &a) {
  for (auto &i : a) {
    str >> i;
  }
  return str;
}
template <class T>
ostream &operator<<(ostream &str, pair<T, T> &a) {
  str << a.first << " " << a.second;
  return str;
}
template <class T>
istream &operator>>(istream &str, pair<T, T> &a) {
  str >> a.first >> a.second;
  return str;
}
void solve();
signed main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(6);
  solve();
  return 0;
}
const long long MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18 + 10, BASE = 37;
vector<vector<long long>> gen(vector<long long> &first, long long a) {
  long long n = (long long)((first).size());
  vector<long long> h_bit((1ll << n));
  for (long long mask = 2; mask < (1ll << n); ++mask) {
    h_bit[mask] = h_bit[mask / 2] + 1;
  }
  vector<long long> s((1ll << n));
  s[1] = first[0];
  for (long long mask = 2; mask < (1ll << n); ++mask) {
    s[mask] = (first[h_bit[mask]] + s[mask ^ (1ll << h_bit[mask])]);
  }
  vector<vector<long long>> ans((long long)((first).size()) + 1,
                                vector<long long>(1250 + 1, 0));
  for (long long mask = 0; mask < (1ll << n); ++mask) {
    long long cnt = __builtin_popcount(mask);
    ans[cnt][s[mask]]++;
  }
  return ans;
}
void solve() {
  long long n, a;
  cin >> n >> a;
  vector<long long> first(n);
  cin >> first;
  if (n == 1) {
    if (first[0] == a) {
      cout << 1 << '\n';
    } else {
      cout << 0 << '\n';
    }
    return;
  }
  vector<long long> v1, v2;
  for (long long i = 0; i < n / 2; ++i) {
    v1.push_back(first[i]);
  }
  for (long long i = n / 2; i < n; ++i) {
    v2.push_back(first[i]);
  }
  long long ans = 0;
  vector<vector<long long>> V1 = gen(v1, a), V2 = gen(v2, a);
  for (long long k1 = 0; k1 < (long long)((V1).size()); ++k1) {
    for (long long k2 = 0; k2 < (long long)((V2).size()); ++k2) {
      if (k1 + k2 == 0) continue;
      for (long long i = 0; i < (long long)((V1[k1]).size()); ++i) {
        if (a * (k1 + k2) - i >= (long long)((V2[k2]).size()) ||
            a * (k1 + k2) - i < 0)
          continue;
        ans += V1[k1][i] * V2[k2][a * (k1 + k2) - i];
      }
    }
  }
  cout << ans << '\n';
}
