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

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



answer = []

for i in range(N):

  if i + K > N:

    break

  Ys, Yt = X[i], X[i+K-1]

  if Ys > 0:

    answer.append(Yt)

  elif Yt < 0:

    answer.append(-Ys)

  else:

    answer.append(min(Ys*(-2)+Yt, Yt*2-Ys))



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

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



answer = 10 ** 18

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

    left, right = i, i + K - 1

    al, ar = abs(X[left]), abs(X[right])

    if X[left] * X[right] >= 0:

        answer = min(answer, max(al, ar))

    else:

        answer = min(answer, al * 2 + ar, al + ar * 2)

        

print(answer)
N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
answer = []
for i in range(N):
    if i + K > N:
        break
    Ys, Yt = X[i], X[i + K - 1]
    if Ys > 0:
        answer.append(Yt)
    elif Yt < 0:
        answer.append(-Ys)
    else:
        answer.append(min(Ys * (-2) + Yt, Yt * 2 - Ys))
print((min(answer)))

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
answer = 10**18
for i in range(N - K + 1):
    left, right = i, i + K - 1
    al, ar = abs(X[left]), abs(X[right])
    if X[left] * X[right] >= 0:
        answer = min(answer, max(al, ar))
    else:
        answer = min(answer, al * 2 + ar, al + ar * 2)
print(answer)

-answer = [] -for i in range(N): -    if i + K > N: -        break -    Ys, Yt = X[i], X[i + K - 1] -    if Ys > 0: -        answer.append(Yt) -    elif Yt < 0: -        answer.append(-Ys) +answer = 10**18 +for i in range(N - K + 1): +    left, right = i, i + K - 1 +    al, ar = abs(X[left]), abs(X[right]) +    if X[left] * X[right] >= 0: +        answer = min(answer, max(al, ar)) -        answer.append(min(Ys * (-2) + Yt, Yt * 2 - Ys)) -print((min(answer))) +        answer = min(answer, al * 2 + ar, al + ar * 2) +print(answer)