import Data.Int import Data.List import Control.Monad main = do [n,m] <- map read . words <$> getLine :: IO [Int] as <- map read . words <$> getLine :: IO [Int64] mapM_ print $ map sum . filter (\xs -> (odd $ head xs) && (length xs >= m)) . groupBy (\x y -> x`mod`2 == y`mod`2) $ as