#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

unordered_map<int,int> a[26];
unordered_map<int,int> b[26];

int x[51];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, av; cin >> n >> av;
	for(int i = 0; i < n; i++)
	{
		cin >> x[i];
	}
	int l = n/2;
	int r = n - l;
	for(int i = 0; i < (1<<l); i++)
	{
		//if(i%100000==0) cout << i << endl;
		int bit = __builtin_popcount(i);
		int sum = 0;
		for(int j = 0; j < l; j++)
		{
			if(i&(1<<j)) sum += x[j];
		}
		a[bit][sum]++;
	}
	//cout << "PART 1 COMPLETE\n";
	for(int i = 0; i < (1<<r); i++)
	{
		int bit = __builtin_popcount(i);
		int sum = 0;
		for(int j = 0; j < r; j++)
		{
			if(i&(1<<j)) sum += x[j+l];
		}
		b[bit][sum]++;
	}
	//cout << "PART 2 COMPLETE\n";
	ll ans = 0;
	for(int i = 0; i <= l; i++)
	{
		for(map<int,int>::iterator it = a[i].begin(); it != a[i].end(); it++)
		{
			int sum = it->fi;
			//cout << sum << '\n';
			for(int k = 0; k < 26; k++)
			{
				if(i + k == 0) continue;
				ans += it->se*b[k][av*(i+k) - sum];
			}
		}
	}
	cout << ans;
}
