program main
  implicit none
  integer(8) :: n, a, i, j, j2
  integer(8), allocatable :: xn(:)
  integer(8), parameter :: MX = 2500
  integer(8) :: dp1(-MX:MX), dp2(-MX:MX)
  read(*, *) n, a
  allocate(xn(n))
  read(*, *) (xn(i), i = 1, n)

  do i = 1, n
    xn(i) = xn(i) - a
  end do

  dp1(:) = 0
  dp1(0) = 1

  do i = 1, n
    dp2(:) = dp1(:)
    do j = -MX, MX
      j2 = j + xn(i)
      if (-MX <= j2 .and. j2 <= MX) then
        dp2(j2) = dp2(j2) + dp1(j)
      end if
    end do
    dp1(:) = dp2(:)
  end do

  write(*, "(i0)") dp2(0) - 1

  deallocate(xn)
  contains
end
