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

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



answer = 10 ** 9

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

    b, c = X[i], X[i+K-1]

    if b * c >= 0:

        answer = min(answer, max(abs(b), abs(c)))

    else:

        d, e = min(abs(b), abs(c)), max(abs(b), abs(c))

        answer = min(answer, d*2+e)

print(answer)

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

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



answer = []

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

    a, b = X[i], X[i+K-1]

    answer.append(min(abs(a-b) + abs(b), abs(b-a) + abs(a)))

print((min(answer)))

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
answer = 10**9
for i in range(N - K + 1):
    b, c = X[i], X[i + K - 1]
    if b * c >= 0:
        answer = min(answer, max(abs(b), abs(c)))
    else:
        d, e = min(abs(b), abs(c)), max(abs(b), abs(c))
        answer = min(answer, d * 2 + e)
print(answer)

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
answer = []
for i in range(N - K + 1):
    a, b = X[i], X[i + K - 1]
    answer.append(min(abs(a - b) + abs(b), abs(b - a) + abs(a)))
print((min(answer)))

-answer = 10**9 +answer = [] -    b, c = X[i], X[i + K - 1] -    if b * c >= 0: -        answer = min(answer, max(abs(b), abs(c))) -    else: -        d, e = min(abs(b), abs(c)), max(abs(b), abs(c)) -        answer = min(answer, d * 2 + e) -print(answer) +    a, b = X[i], X[i + K - 1] +    answer.append(min(abs(a - b) + abs(b), abs(b - a) + abs(a))) +print((min(answer)))