program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n,ans
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) n,k
    allocate(x(n))
    read(*,*)x
    a=0
    do i=1,n
        if(mod(x(i),2)==0)then
            a=a+1
        end if
    end do
    
    b=n-a
    if(k==0)then
        ans=2**a
        if(b>0)then
            ans=ans*2**(b-1)
        end if
    else
        if(b==0)then
            ans=0
        else
            ans=2**a*2**(b-1)
        end if
    end if
    write(*,*)ans


    stop
end program sample
  

