let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let xs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun x -> x in
  Printf.printf "%d\n" @@ Array.fold_left min max_int @@ 
  Array.init (n - k + 1) @@ fun i ->
    if (xs.(i) <= 0) = (xs.(i + k - 1) <= 0) then
      max (abs xs.(i)) (abs xs.(i + k - 1))
    else
      min (2 * abs xs.(i) + abs xs.(i + k - 1)) (abs xs.(i) + 2 * abs xs.(i + k - 1))

