let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n, k = Scanf.sscanf (read_line ()) "%d %d" @@ fun n k -> (n, k)
let x = read_line () |> split_string ~pattern:" " |> List.map int_of_string

let rec split low high = function
  | [] -> (Array.of_list low, Array.of_list @@ List.rev high)
  | x :: xs when x < 0 -> split (-x :: low) high xs
  | x :: xs -> split low (x :: high) xs

let low, high = split [] [] x

let low_len = Array.length low
let high_len = Array.length high

let rec solve1 m = function
  | 0 -> m
  | i -> 
      if k - i > high_len then m
      else let t = if k = i then low.(i - 1) else low.(i - 1) * 2 + high.(k - i - 1) in solve1 (min m t) (i - 1)

let rec solve2 m = function
  | 0 -> m
  | i -> 
      if k - i > low_len then m
      else let t = if k = i then high.(i - 1) else high.(i - 1) * 2 + low.(k - i - 1) in solve2 (min m t) (i - 1)

let () = Printf.printf "%d\n" @@ min (solve1 max_int (min low_len k)) (solve2 max_int (min high_len k))