main = do
  [_, p] <- r
  as <- r
  print $ f p (g as)
 
r = 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)