import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (transpose)

main :: IO ()
main = do
  (n : k : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  ps <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    cs :: [Int]
    cs = scanl (+) 0 ps
    m :: Int
    m = maximum . diff $ cs
      where
        diff :: [Int] -> [Int]
        diff = zipWith subtract <$> id <*> drop k
  print . fromRational $ toRational (m + k) / 2

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
