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

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

ans=float('inf')



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

    ans=min(ans,abs(x[i])+abs(x[i]-x[i+k-1]),abs(x[i+k-1])+abs(x[i]-x[i+k-1]))

    

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

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



ans=float('inf')

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

    temp=x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1]))

    if ans>temp:ans=temp

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

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

-    ans = min( -        ans, -        abs(x[i]) + abs(x[i] - x[i + k - 1]), -        abs(x[i + k - 1]) + abs(x[i] - x[i + k - 1]), -    ) +    temp = x[i + k - 1] - x[i] + min(abs(x[i]), abs(x[i + k - 1])) +    if ans > temp: +        ans = temp