#include <bits/stdc++.h>
using namespace std;
int N, A;
int a[55];
long long int dp[55][2550];
int main() {
  cin >> N >> A;
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) dp[i][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= 2500; j++) {
      dp[i + 1][j] += max(dp[i][j - a[i]] + dp[i][j], dp[i][j]);
    }
  }
  long long int cnt = 0;
  for (int i = 1; i <= 50; i++) cnt += dp[N][A * i];
  cout << cnt << endl;
  return 0;
}
