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

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

ans=float("inf")

for l in range(n-k+1):

    r=l+k-1

    ans=min(ans,

            abs(candle[l])+abs(candle[l]-candle[r]),

            abs(candle[r])+abs(candle[r]-candle[l])

            )

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

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

ans=float("inf")

for i in range(n-k+1):

    left,right=i,i+k-1

    ans=min(ans,

            abs(line[left])+abs(line[left]-line[right]),

            abs(line[right])+abs(line[right]-line[left])

            )

print(ans)
n, k = list(map(int, input().split()))
candle = list(map(int, input().split()))
ans = float("inf")
for l in range(n - k + 1):
    r = l + k - 1
    ans = min(
        ans,
        abs(candle[l]) + abs(candle[l] - candle[r]),
        abs(candle[r]) + abs(candle[r] - candle[l]),
    )
print(ans)

n, k = list(map(int, input().split()))
line = list(map(int, input().split()))
ans = float("inf")
for i in range(n - k + 1):
    left, right = i, i + k - 1
    ans = min(
        ans,
        abs(line[left]) + abs(line[left] - line[right]),
        abs(line[right]) + abs(line[right] - line[left]),
    )
print(ans)

-candle = list(map(int, input().split())) +line = list(map(int, input().split())) -for l in range(n - k + 1): -    r = l + k - 1 +for i in range(n - k + 1): +    left, right = i, i + k - 1 -        abs(candle[l]) + abs(candle[l] - candle[r]), -        abs(candle[r]) + abs(candle[r] - candle[l]), +        abs(line[left]) + abs(line[left] - line[right]), +        abs(line[right]) + abs(line[right] - line[left]),