
#include <iostream>
#include <cstdio>
#define N 55
using namespace std;

typedef long long ll;
ll n, m, s, a[N], d[N * N][N];
int main()
{
	ll i, j, k;
	cin >> n >> m;
	for (i = 0; i < n; i++) scanf("%lld", &a[i]);
	for (i = 0; i < n; i++) {
		for (j = n * m; j >= a[i]; j--) {
			for (k = 1; k <= i; k++) d[j][k + 1] += d[j - a[i]][k];
		}
		d[a[i]][1]++;
	}
	for (i = 1; i <= n * m; i++) {
		for (j = 1; j <= n; j++) if (m * j == i) s += d[i][j];
	}
	cout << s;
    return 0;
}