open Printf
open Scanf

let id x = x

let n, k = scanf "%d %d" (fun n k -> n, k)

let negList = ref []
let posList = ref []
let zero = ref false

let () =
    for i = 1 to n do
        let v = scanf " %d" id in
        if v = 0 then
            zero := true
        else if v < 0 then
            negList := ~-v :: !negList
        else    
            posList := v :: !posList
    done;
    posList := List.rev !posList

let negA = Array.of_list !negList
let posA = Array.of_list !posList

let flipNeg rest =
    let result = ref max_int in
    if Array.length negA > 0 then
        for i = 0 to Array.length negA - 1 do
            let score = if rest - (i + 1) > 0 then
                if rest - (i + 1) - 1 < Array.length posA then
                    negA.(i) * 2 + posA.(rest - (i + 1) - 1)
                else
                    max_int
            else
                negA.(i)
            in
            result := min !result score
        done;
    !result

let flipPos rest =
    let result = ref max_int in
    if Array.length posA > 0 then
        for i = 0 to Array.length posA - 1 do
            let score = if rest - (i + 1) > 0 then
                if rest - (i + 1) - 1 < Array.length negA then
                    posA.(i) * 2 + negA.(rest - (i + 1) - 1)
                else
                    max_int
            else
                posA.(i)
            in
            result := min !result score
        done;
    !result

let () =
    let rest = if !zero then k - 1 else k in
    if rest > 0 then begin
        let x = flipNeg rest in
        let y = flipPos rest in
        printf "%d\n" (min x y)
    end else
        printf "%d\n" 0
