open Batteries
let n, k = Scanf.sscanf (read_line()) "%d %d" (fun n k -> n,k)
let a = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ fun a -> a


let rec main_loop i dp =
  if i >= n then print_string "\n" else (
    Printf.printf "%d " dp.(i); 
    main_loop (i+1) dp
  )

let rec k_loop l a_ =
  if l >= k then a_ else begin
  let dp = Array.init n @@ fun _ -> 0 in
  let rec do_lamp lamp =
  for i = lamp - a_.(lamp) to lamp + a_.(lamp) do
    if i < 0 || i >= 5 then () else (
      dp.(i) <- dp.(i) + 1
    )
  done in

  let rec loop i =
  if i >= n then () else (
    do_lamp i; loop (i+1)
  )
  in loop 0; k_loop (l+1) dp
  end

let dp1 = k_loop 0 a

let _ = main_loop 0 dp1