main :: IO ()
main = do
  [n,k] <- map (read :: String -> Int) . words <$> getLine
  pn <- map (read :: String -> Int) . words <$> getLine
  let an = take k pn
  let bn = drop k pn
  print . (/2) . fromIntegral . (+k) $ ans an bn
  
ans :: [Int] -> [Int] -> Int
ans an [] = sum an
ans an bn = max (sum an) (ans (tail an ++ [head bn]) (tail bn))