c n r = product [n-r+1..n] `div` product [1..r]
main = do
  [n,p] <- map read . words <$> getLine
  as <- map read . words <$> getLine
  let e = sum [1 | a <- as, even a]
      o = n - e
  print $ sum [
    c e x * c o y |
    x <- [0..e], 
    y <- [0..o],
    y `mod` 2 == p]