function Main(input) {
    input = input.split("\n");
    var nk = input[0].split(" ");
    var n = parseInt(nk[0], 10);
    var k = parseInt(nk[1], 10);
    var X = input[1].split(" ").map(x => parseInt(x, 10));
    var zeroInd = -1;
    for (var i = 0; i < n; i++) {
        if (X[i] >= 0) {
            zeroInd = i;
            break;
        }
    }
    if (X[n-1] < 0) {
        zeroInd = n;
    }
    var left = Math.max(zeroInd - k, 0);
    var right = Math.min(zeroInd + k, n);
    var sofar = 1000000001;
    for (var i = left; i < right-k+1; i++) {
        var leftHalf = 0;
        var rightHalf = 0;
        if (i < zeroInd) {
            leftHalf = Math.abs(X[i]);
            rightHalf = Math.max(X[i+k-1], 0);
        } else if (i >= zeroInd) {
            leftHalf = 0;
            rightHalf = X[i+k-1];
        }
        var candid = Math.min(leftHalf*2+rightHalf, leftHalf+rightHalf*2)
        sofar = Math.min(sofar, candid);
    }
    console.log(sofar);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));