import Prelude
import Data.List
import Control.Monad

solver :: Int->[Int]->Int
solver p list
    |p==1 && on==0 = 0
    |p==0 && on==0 = 2^nn
    |otherwise = 2^(nn-1)
    where
        on = length $ filter odd list
        nn = length list

main = do
    [n, p] <- map read . words <$> getLine
    list <- map read . words <$> getLine
    -- 出力
    print $ solver p list

