#include <bits/stdc++.h>
using namespace std;
long long dp[55][55][3000];
int main() {
  int n, m;
  int a[50];
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long ans = 0;
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = (long long)1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= i; j++) {
      for (int k = 3000; k >= 0; k--) {
        dp[i][j][k] = dp[i - 1][j][k];
        if (k >= a[i] && j) dp[i][j][k] += dp[i - 1][j - 1][k - a[i]];
      }
    }
  for (int i = 1; i <= n; i++) {
    ans += dp[n][i][i * m];
  }
  cout << ans;
}
