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

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

let rec countOne cntk cnt1 prev xs =
    match cntk with
    | -1 -> cnt1
    | _ ->
        match xs with
        | x :: xs ->
            if cntk = 0 && x = 0 then cnt1
            elif x = prev then countOne cntk (cnt1 + 1) x xs
            else countOne (cntk - 1) (cnt1 + 1) x xs
        | _ -> cnt1

let ls =
    str
    |> List.mapi (fun i c ->
           if c = 1 then i
           else 0)
    |> List.distinct

let ls2 =
    [ for i in [ 0..ls.Length - 1 ] ->
          if i = ls.Length - 1 then ls.[i]
          elif ls.[i] = ls.[i + 1] - 1 then 0
          else ls.[i] ]
    |> List.distinct

let ls3 = 1 :: ls2

[ for l in ls3 -> countOne (k * 2) 0 1 str.[l..] ]
|> List.max
|> printfn "%d"
