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, y) = frac x * sum [ c y k | k <- [0 .. y], even (k - p)]
 
c n k = frac n `div` frac k `div` frac (n - k)
 
frac n = foldl' (*) [1 .. n] 1