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

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

d = [0 for _ in range(n)]

S = [0 for _ in range(n)]

for i in range(1, n):

    d[i] = x[i] - x[i - 1]

    S[i] = S[i - 1] + d[i]

tmp = [0 for _ in range(n - k + 1)]

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

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

print((min(tmp)))

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

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

ans = abs(x[-1] - x[0]) * 2

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

    l = x[i]

    r = x[i + k - 1]

    if r < 0:

        ans = min(ans, -l)

    elif l > 0:

        ans = min(ans, r)

    else:

        ans = min(ans, r - l + min(-l, r))

print(ans)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
d = [0 for _ in range(n)]
S = [0 for _ in range(n)]
for i in range(1, n):
    d[i] = x[i] - x[i - 1]
    S[i] = S[i - 1] + d[i]
tmp = [0 for _ in range(n - k + 1)]
for i in range(n - k + 1):
    tmp[i] = S[i + k - 1] - S[i] + min(abs(x[i]), abs(x[i + k - 1]))
print((min(tmp)))

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

-d = [0 for _ in range(n)] -S = [0 for _ in range(n)] -for i in range(1, n): -    d[i] = x[i] - x[i - 1] -    S[i] = S[i - 1] + d[i] -tmp = [0 for _ in range(n - k + 1)] +ans = abs(x[-1] - x[0]) * 2 -    tmp[i] = S[i + k - 1] - S[i] + min(abs(x[i]), abs(x[i + k - 1])) -print((min(tmp))) +    l = x[i] +    r = x[i + k - 1] +    if r < 0: +        ans = min(ans, -l) +    elif l > 0: +        ans = min(ans, r) +    else: +        ans = min(ans, r - l + min(-l, r)) +print(ans)