import Data.List (group)
import Data.Bool (bool)
import qualified Data.Sequence as Q

main :: IO ()
main = do
  (n : k : _) <- map read . words <$> getLine :: IO [Int]
  s <- map (== '1') <$> getLine :: IO [Bool]
  let
    s' = f . bool id ((False, 0) :) (head s == True) . map ((,) <$> head <*> length) . group $ s :: [(Bool, Int)]
      where
        f (x : x' : xs) = (snd x + snd x') : f xs
        f (x : _) = [snd x]
        f _ = []
    
    (pr, sf) = splitAt (k + 1) s'
    step (m, q) k = let {(l Q.:< q') = Q.viewL q; m' = m - l + k} in (max m m', q')
  print . fst . foldl step (sum pr, Q.fromList pr) $ sf
