import Data.List
 
main = do
  [n, p] <- readNums
  as <- readNums
  print $ f p (g as)
 
readNums = map read . words <$> getLine
 
g as = (x, y)
  where 
    x = length . filter even $ as
    y = length . filter odd $ as
 
f p (x, 0) = (2 ^ x) * (1 - p)
f p (x, y) = 2 ^ (x + y - 1)