module Main where

import           Data.List

toInt :: String -> Int
toInt s = read s :: Int

strToIntList :: String -> [Int]
strToIntList = map toInt . words

main :: IO ()
main = do
  l1 <- getLine
  l2 <- getLine
  let (_ : k : _) = strToIntList l1
  let ps          = scanl (+) 0 $ strToIntList l2
  print . maximum . map (\x -> fromIntegral (k+x)/2) $ diff k ps

diff diffNum = zipWith subtract <$> id <*> drop diffNum