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

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



ans = 10**9



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

    if x[i] < 0:

        if x[i + k - 1] < 0:

            ref = -x[i]

        else:

            ref = min(x[i]*-2 + x[i + k - 1], -x[i] + x[i + k - 1]*2)

    else:

        ref = x[i + k - 1]

    ans = min(ans, ref)



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

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

k -= 1

ans = 10**9



for i in range(n - k):

    l = x[i]

    r = x[i + k]

    if l < 0:

        if r < 0:

            ref = -l

        else:

            ref = min(l*-2 + r, -l + r*2)

    else:

        ref = r

    ans = min(ans, ref)



print(ans)
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(n - k + 1):
    if x[i] < 0:
        if x[i + k - 1] < 0:
            ref = -x[i]
        else:
            ref = min(x[i] * -2 + x[i + k - 1], -x[i] + x[i + k - 1] * 2)
    else:
        ref = x[i + k - 1]
    ans = min(ans, ref)
print(ans)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
k -= 1
ans = 10**9
for i in range(n - k):
    l = x[i]
    r = x[i + k]
    if l < 0:
        if r < 0:
            ref = -l
        else:
            ref = min(l * -2 + r, -l + r * 2)
    else:
        ref = r
    ans = min(ans, ref)
print(ans)

+k -= 1 -for i in range(n - k + 1): -    if x[i] < 0: -        if x[i + k - 1] < 0: -            ref = -x[i] +for i in range(n - k): +    l = x[i] +    r = x[i + k] +    if l < 0: +        if r < 0: +            ref = -l -            ref = min(x[i] * -2 + x[i + k - 1], -x[i] + x[i + k - 1] * 2) +            ref = min(l * -2 + r, -l + r * 2) -        ref = x[i + k - 1] +        ref = r