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

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

ret = 10 ** 9

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

    init = abs(x[i])

    dist = abs(x[i]-x[i+K-1])

    l = init + dist

    init = abs(x[i+K-1])

    r = init + dist

    ret = min(ret, l, r)

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

lista = [int(i) for i in input().split()]



minv = 10**9



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

    head = lista[i]

    tail = lista[i+k-1]

    if head*tail <0:

        if abs(head)>abs(tail):

            temp = abs(head) + 2*abs(tail)

        else:

            temp = 2*abs(head) + abs(tail)

        if minv>temp:

            minv=temp

    else:

        temp = max(abs(head),abs(tail))

        if minv>temp:

            minv=temp

            

print(minv)
N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
ret = 10**9
for i in range(N - K + 1):
    init = abs(x[i])
    dist = abs(x[i] - x[i + K - 1])
    l = init + dist
    init = abs(x[i + K - 1])
    r = init + dist
    ret = min(ret, l, r)
print(ret)

n, k = list(map(int, input().split()))
lista = [int(i) for i in input().split()]
minv = 10**9
for i in range(n - k + 1):
    head = lista[i]
    tail = lista[i + k - 1]
    if head * tail < 0:
        if abs(head) > abs(tail):
            temp = abs(head) + 2 * abs(tail)
        else:
            temp = 2 * abs(head) + abs(tail)
        if minv > temp:
            minv = temp
    else:
        temp = max(abs(head), abs(tail))
        if minv > temp:
            minv = temp
print(minv)

-N, K = list(map(int, input().split())) -x = list(map(int, input().split())) -ret = 10**9 -for i in range(N - K + 1): -    init = abs(x[i]) -    dist = abs(x[i] - x[i + K - 1]) -    l = init + dist -    init = abs(x[i + K - 1]) -    r = init + dist -    ret = min(ret, l, r) -print(ret) +n, k = list(map(int, input().split())) +lista = [int(i) for i in input().split()] +minv = 10**9 +for i in range(n - k + 1): +    head = lista[i] +    tail = lista[i + k - 1] +    if head * tail < 0: +        if abs(head) > abs(tail): +            temp = abs(head) + 2 * abs(tail) +        else: +            temp = 2 * abs(head) + abs(tail) +        if minv > temp: +            minv = temp +    else: +        temp = max(abs(head), abs(tail)) +        if minv > temp: +            minv = temp +print(minv)