import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;
import std.numeric;

void main()
{
    auto nk = readln.split.to!(long[]);
    long n = nk[0];
    long k = nk[1];
    long[] X = readln.split.to!(long[]);

    long result = long.max;

    foreach (i; 0 .. n - k + 1)
    {
        long a = (X[i + k - 1] - X[i]);
        long b = min(abs(X[i + k - 1]), abs(X[i]));
        result = result.min(a + b);
    }
    result.writeln;
}
