N, K = list(map(int, input().split()))

X = list(map(int, input().split()))

num = float("inf")

for i in range(N - K + 1):

    p = X[i]

    q = X[i + K - 1]

    if q < 0:

        num = min(num, abs(p))

    elif p < 0:

        num = min(num, abs(p) + 2 * abs(q))

        num = min(num, abs(p) * 2 + abs(q))

    else:

        num = min(num, q)



print(num)





N, K = list(map(int, input().split()))

x = list(map(int, input().split()))

ans = float('inf')

for i in range(N - K + 1):

    L = x[i]

    R = x[i + K - 1]

    if R < 0:

        ans = min(ans, -L)

    elif L < 0 <= R:

        ans = min(ans, -2 * L + R, -L + 2 * R)

    else:

        ans = min(ans, R)



print(ans)

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
num = float("inf")
for i in range(N - K + 1):
    p = X[i]
    q = X[i + K - 1]
    if q < 0:
        num = min(num, abs(p))
    elif p < 0:
        num = min(num, abs(p) + 2 * abs(q))
        num = min(num, abs(p) * 2 + abs(q))
    else:
        num = min(num, q)
print(num)

N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = float("inf")
for i in range(N - K + 1):
    L = x[i]
    R = x[i + K - 1]
    if R < 0:
        ans = min(ans, -L)
    elif L < 0 <= R:
        ans = min(ans, -2 * L + R, -L + 2 * R)
    else:
        ans = min(ans, R)
print(ans)

-X = list(map(int, input().split())) -num = float("inf") +x = list(map(int, input().split())) +ans = float("inf") -    p = X[i] -    q = X[i + K - 1] -    if q < 0: -        num = min(num, abs(p)) -    elif p < 0: -        num = min(num, abs(p) + 2 * abs(q)) -        num = min(num, abs(p) * 2 + abs(q)) +    L = x[i] +    R = x[i + K - 1] +    if R < 0: +        ans = min(ans, -L) +    elif L < 0 <= R: +        ans = min(ans, -2 * L + R, -L + 2 * R) -        num = min(num, q) -print(num) +        ans = min(ans, R) +print(ans)