import bisect

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

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

t = 2 * (x[-1] - x[0])

i = bisect.bisect_right(x, 0)

for j in range(0, N):

    if N <= j + K -1 :

        break

    if (j - (i - 0.1)) * (j + K- 1 - (i - 0.1)) >= 0:

        t = min(t, max(abs(x[j]), abs(x[j+K-1])))

    else:

        t = min(t, abs(2 * x[j]) + x[j+K-1])

        t = min(t, abs(x[j]) + 2 * x[j+K-1])

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

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

dist = 2 * (x[-1] - x[0])

for i in range(N):

    if i + K -1 >= N:

        break

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

print(dist)
import bisect

N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
t = 2 * (x[-1] - x[0])
i = bisect.bisect_right(x, 0)
for j in range(0, N):
    if N <= j + K - 1:
        break
    if (j - (i - 0.1)) * (j + K - 1 - (i - 0.1)) >= 0:
        t = min(t, max(abs(x[j]), abs(x[j + K - 1])))
    else:
        t = min(t, abs(2 * x[j]) + x[j + K - 1])
        t = min(t, abs(x[j]) + 2 * x[j + K - 1])
print(t)

N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
dist = 2 * (x[-1] - x[0])
for i in range(N):
    if i + K - 1 >= N:
        break
    dist = min(
        dist,
        abs(x[i]) + abs(x[i + K - 1] - x[i]),
        abs(x[i + K - 1]) + abs(x[i + K - 1] - x[i]),
    )
print(dist)

-import bisect - -t = 2 * (x[-1] - x[0]) -i = bisect.bisect_right(x, 0) -for j in range(0, N): -    if N <= j + K - 1: +dist = 2 * (x[-1] - x[0]) +for i in range(N): +    if i + K - 1 >= N: -    if (j - (i - 0.1)) * (j + K - 1 - (i - 0.1)) >= 0: -        t = min(t, max(abs(x[j]), abs(x[j + K - 1]))) -    else: -        t = min(t, abs(2 * x[j]) + x[j + K - 1]) -        t = min(t, abs(x[j]) + 2 * x[j + K - 1]) -print(t) +    dist = min( +        dist, +        abs(x[i]) + abs(x[i + K - 1] - x[i]), +        abs(x[i + K - 1]) + abs(x[i + K - 1] - x[i]), +    ) +print(dist)