#include <bits/stdc++.h>
int N, A;
int arr[51];
long long int sum[2][125111];
int main() {
  long long int ans = 0;
  int i, j, k;
  int now = 0;
  scanf("%d%d", &N, &A);
  for (i = 0; i < N; i++) {
    scanf("%d", &arr[i]);
    arr[i] += 2500;
  }
  sum[now][0] = 1;
  for (i = 0; i < N; i++) {
    now = 1 - now;
    for (j = 0; j < arr[i]; j++) sum[now][j] = sum[1 - now][j];
    for (j = arr[i]; j <= 125000; j++)
      sum[now][j] = sum[1 - now][j] + sum[1 - now][j - arr[i]];
  }
  for (i = 1; i <= N; i++) {
    ans += sum[now][i * (A + 2500)];
  }
  printf("%lld\n", ans);
  return 0;
}
