import Control.Monad
import Data.Char
import qualified Data.Sequence as S

main = do
    [n, k] <- map read <$> words <$> getLine
    s      <- getLine
    putStrLn $ show $ solve n k s

solve :: Int -> Int -> String -> Int
solve n k s = doit 1 (S.fromList $ replicate (k * 2 + 1) 0) s
  where
    doit :: Int -> (S.Seq Int) -> String -> Int
    doit d l []        = length s - S.index l 0
    doit 0 l ('1' : t) = max (pos - S.index l 0) (doit 1 (l          S.|> pos) t) where pos = length s - length t - 1
    doit 1 l ('0' : t) = max (pos - S.index l 0) (doit 0 (S.drop 2 l S.|> pos) t) where pos = length s - length t - 1
    doit d l ( _  : t) = doit d l t