#include <iostream>
#include <cstdio>
using namespace std;

int n, a;
int x[51];
long long dp[51][2501];


int main()
{
	long long sum(0ll), ans(0ll);
	
	scanf("%d%d", &n, &a);
	for (int i = 1; i <= n; ++i)
		scanf("%d", x + i);
	dp[0][0] = 1ll;
	for (int i = 1; i <= n; ++i) {
		sum += x[i];
		for (int j = i; j; --j)
			for (int k = sum; k >= x[i]; --k)
				dp[j][k] += dp[j - 1][k - x[i]];
	}
	for (int i = 1; i <= n; ++i)
		ans += dp[i][a * i];
	printf("%lld\n", ans);
	return 0;
}

