import Data.Array.IO

main = do
    [n,k] <- (map read . words) <$> getLine :: IO [Int]
    s <- getLine
    let s' = 0:0:preproc s++[0,0]
    arr <- buildAccum s'
    s'' <- postproc' arr (2*k+1) 3
    print $ if s'' == [] then n else maximum s''


preproc :: String -> [Int]
preproc s = let h = head s in
            if h == '0' then 0:preprocAux h 0 s
                        else   preprocAux h 0 s
    where
        preprocAux :: Char -> Int -> String -> [Int]
        preprocAux cur ac [] = if cur=='0' then [ac,0] else [ac]
        preprocAux cur ac xx@(x:xs) = if x == cur
            then    preprocAux x (ac+1) xs
            else ac:preprocAux x 1 xs

postproc' :: IOArray Int Int -> Int -> Int -> IO [Int] 
postproc' arr n curPos = do
    (_,br) <- getBounds arr
    if br-curPos+1 < n
        then return []
        else do
            x <- sum' arr n curPos
            recls <- postproc' arr n (curPos+2)
            return $ x:recls
                where
                    sum' arr n cur = do
                        r <- readArray arr (cur+n-1)
                        l <- readArray arr (cur-1)
                        return $ r-l

buildAccum :: [Int] -> IO (IOArray Int Int)
buildAccum xs = newArray (1,length xs) 0 >>= (\arr -> buildAccumAux arr 1 0 xs)
    where
        buildAccumAux :: IOArray Int Int -> Int -> Int -> [Int] -> IO (IOArray Int Int)
        buildAccumAux arr pos ac []     = return arr
        buildAccumAux arr pos ac (x:xs) = do
            let accVal = ac+x
            writeArray arr pos accVal
            buildAccumAux arr (pos+1) accVal xs

