import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List as L

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInt
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents
main :: IO ()
main = do
    [n,k] <- getIntList
    p <- getIntList
    let c = [x | x<-L.tails p, length x >= k]
    let e = map (foldl (\acc x -> acc + (fromIntegral (x+1))/2) 0) [take k xs| xs<-c]
    print $ foldr max 0 e