import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,p] <- getIntList
    as <- getIntList
    let evens = all even as
        ans | evens && p == 0 = 2^n
            | evens && p == 1 = 0
            | otherwise = 2^(n-1)
    print ans