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

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

ans = pow(10, 10)

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

    temp_l = abs(x[i]) + abs(x[i]-x[i+K-1])

    temp_r = abs(x[i+K-1]) + abs(x[i]-x[i+K-1])

    ans = min(ans, temp_l, temp_r)

print(ans)

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

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

ans = 10 ** 9

for i in range(len(a) - K + 1):

  l = a[i]

  r = a[i+K-1]

  ans = min(ans, abs(l) + abs(r - l), abs(r) + abs(l - r))

print(ans)
N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = pow(10, 10)
for i in range(N - K + 1):
    temp_l = abs(x[i]) + abs(x[i] - x[i + K - 1])
    temp_r = abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1])
    ans = min(ans, temp_l, temp_r)
print(ans)

N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 10**9
for i in range(len(a) - K + 1):
    l = a[i]
    r = a[i + K - 1]
    ans = min(ans, abs(l) + abs(r - l), abs(r) + abs(l - r))
print(ans)

-x = list(map(int, input().split())) -ans = pow(10, 10) -for i in range(N - K + 1): -    temp_l = abs(x[i]) + abs(x[i] - x[i + K - 1]) -    temp_r = abs(x[i + K - 1]) + abs(x[i] - x[i + K - 1]) -    ans = min(ans, temp_l, temp_r) +a = list(map(int, input().split())) +ans = 10**9 +for i in range(len(a) - K + 1): +    l = a[i] +    r = a[i + K - 1] +    ans = min(ans, abs(l) + abs(r - l), abs(r) + abs(l - r))