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

void main() {
    uint n, k;

    readf(" %s %s\n", &n, &k);
    long[] x = readln.chomp.split.to!(long[]);

    ulong ans = ulong.max;
    foreach(l; 0..n - k + 1) {
        uint r = l + k - 1;
        auto d = x[r] - x[l];
        auto a = min(abs(x[r]) + d, abs(x[l]) + d);
        ans = min(ans, a);
    }

    ans.writeln;
}
