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

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

m = float("INF")

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

    if x[i + K - 1] * x[i] < 0:

        m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))

    else:

        m = min(m, max(abs(x[i + K - 1]), abs(x[i])))

print(m)

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

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

m = float("INF")

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

    m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))

print(m)

N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
m = float("INF")
for i in range(N - K + 1):
    if x[i + K - 1] * x[i] < 0:
        m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))
    else:
        m = min(m, max(abs(x[i + K - 1]), abs(x[i])))
print(m)

N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
m = float("INF")
for i in range(N - K + 1):
    m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))
print(m)

-    if x[i + K - 1] * x[i] < 0: -        m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i]))) -    else: -        m = min(m, max(abs(x[i + K - 1]), abs(x[i]))) +    m = min(m, x[i + K - 1] - x[i] + min(abs(x[i + K - 1]), abs(x[i])))