#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 50;
const int INF = 0x3f3f3f;
long long dp[N][N];
long long sum;
int main() {
  int n, m, a, b;
  scanf("%d%d", &n, &m);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b);
    for (int j = i; j >= 0; j--) {
      for (int k = m * n; k >= b; k--) {
        dp[j][k] += dp[j - 1][k - b];
      }
    }
  }
  for (int i = 1; i <= n; i++) sum += dp[i][i * m];
  printf("%lld\n", sum);
  return 0;
}
