-- Question A

import Control.Applicative
import Control.Monad

main = do
  [n ,p] <- (map read . words) <$> getLine ::IO[Integer]
  xs <- (map read . words) <$> getLine ::IO[Integer]
  putStrLn $ show (counts' n p (ys0 xs) (ys1 xs))
  

ys0 xs = length (filter even xs)
ys1 xs = length (filter odd xs)

counts' a b c d 
 |((b == 1) && (d == 0)) = 0
 | c == 0 = (2^(d) `div` 2)
 | otherwise = 2^(c)+(2^(d) `div` 2)