n, k = list(map(int, input().split()))

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

ans=4*10**8

# zip関数は多い元は無視する.

for a, b in zip(x, x[k-1:]):

    cand = b-a + min(abs(a), abs(b))

    ans = min(cand, ans)

print(ans)
n, k = list(map(int, input().split()))

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

ans=[0]*(n-k+1)

# zip関数は多い元は無視する.

for i, a, b in zip(list(range(n)), x, x[k-1:]):

    ans[i] = b-a + min(abs(a), abs(b))

print((min(ans)))
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 4 * 10**8
# zip関数は多い元は無視する.
for a, b in zip(x, x[k - 1 :]):
    cand = b - a + min(abs(a), abs(b))
    ans = min(cand, ans)
print(ans)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = [0] * (n - k + 1)
# zip関数は多い元は無視する.
for i, a, b in zip(list(range(n)), x, x[k - 1 :]):
    ans[i] = b - a + min(abs(a), abs(b))
print((min(ans)))

-ans = 4 * 10**8 +ans = [0] * (n - k + 1) -for a, b in zip(x, x[k - 1 :]): -    cand = b - a + min(abs(a), abs(b)) -    ans = min(cand, ans) -print(ans) +for i, a, b in zip(list(range(n)), x, x[k - 1 :]): +    ans[i] = b - a + min(abs(a), abs(b)) +print((min(ans)))