let [| n; k |] = stdin.ReadLine().Split(' ') |> Array.map int

let str =
    stdin.ReadLine()
    |> Seq.map (fun c -> int c - 48)
    |> Seq.toList

let rec runLengthEncoder length prev ls lEncoded =
    match ls with
    | l :: ls ->
        if l = prev then runLengthEncoder (length + 1) l ls lEncoded
        else
            runLengthEncoder 1 l ls (if length = 0 then lEncoded
                                     else length :: lEncoded)
    | _ -> length :: lEncoded |> List.rev

let ls = runLengthEncoder 0 -1 str []

let val0 =
    match str.[0] with
    | 0 ->
        if k = 0 then 0
        elif ls.Length = 1 then ls.[0]
        elif k * 2 - 1 > ls.Length then ls |> List.sum
        else ls.[..k * 2 - 1] |> List.sum
    | _ -> 0

let ls2 =
    if str.[0] = 0 then
        if ls.Length <> 1 then ls.[1..]
        else
            match k with
            | 0 -> [ 0 ]
            | _ -> ls
    else ls

[ for i in 0..ls2.Length - 1 ->
      if i + k * 2 > ls2.Length - 1 then ls2.[i..]
      else ls2.[i..i + k * 2] ]
|> List.map List.sum
|> List.max
|> max val0
|> printfn "%d"
