program tak_and_cards
  implicit none
  integer                :: n, a, x(50), lbnd, ubnd, i, j
  integer(8),allocatable :: dp(:,:)
  x = 0
  read(*,*) n, a
  read(*,*) x(1:n)
  x(1:n) = x(1:n) - a
  call merge_sort(x(1:n))
  lbnd = sum(x(1:n),mask=x(1:n)<0)
  ubnd = sum(x(1:n),mask=x(1:n)>0)
  allocate(dp(0:n,lbnd:ubnd))
  dp = 0_8
  dp(0,0) = 1_8
  do j = 1, n
    do i = lbnd, ubnd
      dp(j,i) = dp(j-1,i)
      if ((lbnd.le.i-x(j)).and.(i-x(j).le.ubnd)) then
        dp(j,i) = dp(j,i) + dp(j-1,i-x(j))
      end if 
    end do
  end do
  write(*,'(i0)') dp(n,0)-1_8
  deallocate(dp)
  stop
contains
  subroutine merge_sort(c)
    implicit none
    integer, intent(inout) :: c(:)
    integer                :: n, num, lng, i, ubnd
    n = size(c)
    num = n
    lng = 1
    do while (num.gt.1)
      do i = 1, num/2
        ubnd = min(2*i*lng,n)
        call merge(c(2*(i-1)*lng+1:(2*i-1)*lng),c((2*i-1)*lng+1:ubnd))
      end do
      lng = 2*lng
      num = (num+1)/2
    end do
    return
  end subroutine merge_sort
  subroutine merge(c1,c2)
    implicit none
    integer, intent(inout) :: c1(:), c2(:)
    integer                :: c(size(c1)+size(c2))
    integer                :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1)
    n2 = size(c2)
    do while (i1.le.n1.and.i2.le.n2)
      if (c1(i1).le.c2(i2)) then
        c(i1+i2-1) = c1(i1)
        i1 = i1+1
      else
        c(i1+i2-1) = c2(i2)
        i2 = i2+1
      end if
    end do
    if (i1.le.n1) then
      c(i1+i2-1:n1+n2) = c1(i1:n1)
    else if (i2.le.n2) then
      c(i1+i2-1:n1+n2) = c2(i2:n2)
    end if
    c1 = c(1:n1)
    c2 = c(n1+1:n1+n2)
    return
  end subroutine merge
end program tak_and_cards