solve xs n p
  | p == 0 && o == 0 = 2^e
  | p == 1 && o == 0 = 0
  | otherwise = 2 ^ (n-1)
  where
    (e,o) = foldl step (0,0) xs
    step (a,b) x  
      | even x = (a+1,b)
      | otherwise = (a,b+1)

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