f :: [Int] -> [Int] -> Int -> Int
f _ [] s = s
f (a:as) (b:bs) s = max s (f as bs (s - a + b))

main = do
    [n, k] <- map read . words <$> getLine :: IO [Int]
    p <- map ((+ (-1)) . read) . words <$> getLine :: IO [Int]
    let s = f p (drop k p) (sum (take k p))
    print $ (fromIntegral s) / 2.0 + fromIntegral k
