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

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

kx = x[0:k]

l=kx[0]

r = kx[-1]

lrsmall = min(abs(l),abs(r))

res = r-l+lrsmall

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

    del kx[0]

    kx.append(x[i+k-1])

    l=kx[0]

    r = kx[-1]

    lrsmall = min(abs(l),abs(r))

    res = min(r-l+lrsmall,res)

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

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

res = 10**10

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

    l = x[i]

    r = x[i+k-1]

    lrsmall = min(abs(l),abs(r))

    res = min(r-l+lrsmall,res)

print(res)
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
kx = x[0:k]
l = kx[0]
r = kx[-1]
lrsmall = min(abs(l), abs(r))
res = r - l + lrsmall
for i in range(1, n - k + 1):
    del kx[0]
    kx.append(x[i + k - 1])
    l = kx[0]
    r = kx[-1]
    lrsmall = min(abs(l), abs(r))
    res = min(r - l + lrsmall, res)
print(res)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
res = 10**10
for i in range(0, n - k + 1):
    l = x[i]
    r = x[i + k - 1]
    lrsmall = min(abs(l), abs(r))
    res = min(r - l + lrsmall, res)
print(res)

-kx = x[0:k] -l = kx[0] -r = kx[-1] -lrsmall = min(abs(l), abs(r)) -res = r - l + lrsmall -for i in range(1, n - k + 1): -    del kx[0] -    kx.append(x[i + k - 1]) -    l = kx[0] -    r = kx[-1] +res = 10**10 +for i in range(0, n - k + 1): +    l = x[i] +    r = x[i + k - 1]