let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let s = read_line () in
  let seqs =
    Array.of_list @@ List.rev @@
    match
      (* 1111 0000 *)
      Array.fold_left (fun (acc, s) c ->
        match s, c with
        | `Ones n, '1' -> (acc, `Ones (n + 1))
        | `Zeros (n, m), '0' -> (acc, `Zeros (n, m + 1))
        | `Ones n, '0' -> (acc, `Zeros (n, 1))
        | `Zeros (n, m), '1' -> ((n, m) :: acc, `Ones 1)) ([], `Ones 0) @@
      Array.init (String.length s) (String.get s)
    with
    | (acc, `Ones n) -> (n, 0) :: acc
    | (acc, `Zeros (n, m)) -> (n, m) :: acc in
  if Array.length seqs <= k
  then Printf.printf "%d\n" n
  else begin
    let acc = Array.make (Array.length seqs + 1) 0 in
    for i = 0 to Array.length seqs - 1 do
      acc.(i + 1) <- acc.(i) + fst seqs.(i) + snd seqs.(i)
    done;
    Printf.printf "%d\n" @@
    Array.fold_left max (acc.(Array.length seqs) - acc.(Array.length seqs - k)) @@
    Array.init (Array.length seqs - k) @@ fun i ->
      acc.(i + k) - acc.(i) + fst seqs.(i + k)
  end