

readInt = (read :: String -> Int)
slice a i j = take (j-i+1) $ drop i a 
sumOfPositives a = sum $ filter (> 0) a

score a k wloc = sumOfPositives (slice a 0 (wloc-1)) + (let x = (sum $ slice a wloc (wloc+k-1)) in if x > 0 then x else 0) + sumOfPositives (slice a (wloc + k) $ length a)

maxscore a k = maximum $ map (score a k) [0..(length a - k)] 

main = do
    nums1 <- fmap (map readInt) $ words <$> getLine
    let n = nums1 !! 0
    let k = nums1 !! 1

    a <- fmap (map readInt) $ words <$> getLine
    putStrLn $ show (maxscore a k) 