import Data.List (subsequences)

main:: IO ()
main = do
    [n,p] <- (map read . words) <$> getLine
    as <- (map read . words) <$> getLine
    print $ solve n p as

-- |
--
-- >>> solve 2 0 [1,3]
-- 2
--
solve :: Integer -> Integer -> [Integer] -> Integer
solve n p xs = kO * kE
  where
    numOdds = fromIntegral $ length . filter odd $ xs
    numEvens = n - numOdds
    kE = 2 ^ numEvens
    kO = sum [numOdds `ncr` x | x <- [0 .. numOdds], x `mod` 2 == p]

ncr :: Integer -> Integer -> Integer
ncr n r = fact n `div` (fact r * fact (n-r))

fact :: Integer -> Integer
fact 0 = 1
fact 1 = 1
fact x = x * fact (x-1)
