#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (lint ngtkana_is_a_genius = 0; ngtkana_is_a_genius < lint(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (lint i = lint(begin); (i) < lint(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

template < class Value >
bool bat(Value x, std::size_t pos) { return (x >> pos) & Value{1}; }

/*
半分全列挙です。
まずは全部A引いておけば、合計0を探すのでよいです。
前半と後半、それぞれでありえる合計値を列挙し、前半を全探索して、後半を equal_range です。

間に合わないじゃないですか！！
値の範囲が狭いので重複度付き集合で対応です。
負の値もあるので、下駄を履かせます。
*/

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  int l = n / 2;
  int A; std::cin>>A;
  std::vector<int> a(n); std::cin>>a;
  for (int & x : a) x -= A;
  debug(a);

  auto make_sums = [&] (std::vector<int> const& a) {
    int n = a.size();
    int N = 1 << n;
    std::map<int,lint> ans;
    rep(bs,0,N) {
      lint now = 0;
      rep(i,0,n) {
        if (!bat(bs,i)) continue;
        now += a.at(i);
      }
      ans[now]++;
    }
    return ans;
  };
  auto former = make_sums(std::vector<int>(a.begin(), a.begin() + l));
  auto latter = make_sums(std::vector<int>(a.begin() + l, a.end()));
  debug(former,latter);

  lint ans = 0;
  for (auto&& pair : former) {
    int x0; lint y0; std::tie(x0,y0) = pair;
    auto it = latter.find(-x0);
    if (it == latter.end()) continue;
    lint y1 = it->second;
    lint now = y0 * y1;
    ans += now;
  }
  ans--;
  std::cout << ans << std::endl;
  return 0;
}