//解説pdf既読
//分割代入が未対応だった(´･ω･`)
function Main(input) {
    var tmp = [];
    var sum = (array, index, num) => array[index + num - 1] - array[index];
    input = input.split("\n");
    NK = input[0].split(" ").map(Number);
    N = NK[0]; K = NK[1];
    x = input[1].split(" ").map(Number);
    for (var i = 0; i < N - K + 1; i++) tmp.push(Math.abs(x[i]) + sum(x, i, K));
    console.log(Math.min(...tmp));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));