#include <bits/stdc++.h>
using namespace std;
int a[60];
int dp[60][3010];
int n, m, sum, ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int k = 50; k >= 0; k--) {
      for (int y = 0; y <= sum; y++) {
        if (!dp[k][y]) continue;
        dp[k + 1][y + a[i]] += dp[k][y];
      }
    }
  }
  long long ans = 0;
  for (int k = 1; k <= 50; k++)
    for (int y = 0; y <= sum; y++)
      if (k * m == y) ans += dp[k][y];
  cout << ans << endl;
  return 0;
}
