import std.math;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.container;
import std.algorithm;

void main()
{
    int n, k;
    readf("%d %d\n", &n, &k);
    auto a = readln.splitter.map!(to!int).array;
    int ans = int.max;
    foreach (i; 0..n-k+1) {
        ans = min(ans, 
            abs(a[i]) + a[i + k - 1] - a[i],
            abs(a[i + k - 1]) + a[i + k - 1] - a[i]);
    }
    writeln(ans);
}
