#include <bits/stdc++.h>
using namespace std;
LL dp[51][51][2501];
int main()
{
	//freopen("In.txt" , "r" , stdin);
	int N , A;
	cin >> N >> A;
	vector<int> a(N);
	for(auto &x : a)
		cin >> x;
	dp[0][0][0] = 1;
	for(int i = 0; i < N; i++)
	{
		for(int picked = 0; picked <= 50; picked++)
		{
			for(int sum = 0; sum <= i * 50; sum++)
			{
				dp[i + 1][picked + 1][sum + a[i]] +=
				dp[i][picked][sum];
				dp[i + 1][picked][sum] += dp[i][picked][sum];
			}
		}
	}
	LL ans = 0;
	for(int picked = 1; picked <= N; picked++)
		ans += dp[N][picked][picked * A];
	cout << ans;
	return 0;
}
