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

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



ans = float('inf')

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

    l, r = X[i], X[i+k-1]

    if r <= 0:

        ans = min(abs(l), ans)

    elif 0 <= l:

        ans = min(abs(r), ans)

    else:

        dist = min(abs(l), abs(r))*2+max(abs(l), abs(r))

        ans = min(dist, ans)

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):

    l, r = x[i], x[i+k-1]

    if r <= 0:

        a = abs(l)

    elif l >= 0:

        a = r

    else:

        a = min(abs(l), abs(r)) * 2 + max(abs(l), abs(r))

    if ans > a: ans = a

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):
    l, r = X[i], X[i + k - 1]
    if r <= 0:
        ans = min(abs(l), ans)
    elif 0 <= l:
        ans = min(abs(r), ans)
    else:
        dist = min(abs(l), abs(r)) * 2 + max(abs(l), abs(r))
        ans = min(dist, ans)
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):
    l, r = x[i], x[i + k - 1]
    if r <= 0:
        a = abs(l)
    elif l >= 0:
        a = r
    else:
        a = min(abs(l), abs(r)) * 2 + max(abs(l), abs(r))
    if ans > a:
        ans = a
print(ans)

-X = list(map(int, input().split())) +x = list(map(int, input().split())) -    l, r = X[i], X[i + k - 1] +    l, r = x[i], x[i + k - 1] -        ans = min(abs(l), ans) -    elif 0 <= l: -        ans = min(abs(r), ans) +        a = abs(l) +    elif l >= 0: +        a = r -        dist = min(abs(l), abs(r)) * 2 + max(abs(l), abs(r)) -        ans = min(dist, ans) +        a = min(abs(l), abs(r)) * 2 + max(abs(l), abs(r)) +    if ans > a: +        ans = a