let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let acc = Array.make (n + 1) 0 in
  for i = 0 to n - 1 do
    Scanf.scanf "%d " @@ fun a ->
      acc.(max 0 (i - a)) <- acc.(max 0 (i - a)) + 1;
      acc.(min n (i + a + 1)) <- acc.(min n (i + a + 1)) - 1
  done;
  for i = 1 to n - 1 do
    acc.(i) <- acc.(i) + acc.(i - 1)
  done;
  begin try
    for j = 1 to k - 1 do
      let modified = ref false in
      let d = Array.make (n + 1) 0 in
      for i = 0 to n - 1 do
        d.(max 0 (i - acc.(i))) <- d.(max 0 (i - acc.(i))) + 1;
        d.(min n (i + acc.(i) + 1)) <- d.(min n (i + acc.(i) + 1)) - 1
      done;
      if d.(0) <> acc.(0) then modified := true;
      acc.(0) <- d.(0);
      for i = 1 to n - 1 do
        if acc.(i) <> acc.(i - 1) + d.(i) then modified := true;
        acc.(i) <- acc.(i - 1) + d.(i)
      done;
      if not !modified then raise Not_found
    done
  with Not_found -> () end;
  for i = 0 to n - 1 do
    Printf.printf "%d " acc.(i)
  done;
  print_newline ()

