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

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



d = []

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

  l = abs(cans[n]) + abs(cans[n  + (K-1)] - cans[n])

  r = abs(cans[n  + (K-1)]) + abs(cans[n  + (K-1)] - cans[n])

  d.append(min(l,r))



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

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



print((min([min(abs(cans[n]), abs(cans[n  + (K-1)]))  + abs(cans[n  + (K-1)] - cans[n]) for n in range(N-K+1)])))
N, K = list(map(int, input().split()))
cans = list(map(int, input().split()))
d = []
for n in range(N - K + 1):
    l = abs(cans[n]) + abs(cans[n + (K - 1)] - cans[n])
    r = abs(cans[n + (K - 1)]) + abs(cans[n + (K - 1)] - cans[n])
    d.append(min(l, r))
print((min(d)))

N, K = list(map(int, input().split()))
cans = list(map(int, input().split()))
print(
    (
        min(
            [
                min(abs(cans[n]), abs(cans[n + (K - 1)]))
                + abs(cans[n + (K - 1)] - cans[n])
                for n in range(N - K + 1)
            ]
        )
    )
)

-d = [] -for n in range(N - K + 1): -    l = abs(cans[n]) + abs(cans[n + (K - 1)] - cans[n]) -    r = abs(cans[n + (K - 1)]) + abs(cans[n + (K - 1)] - cans[n]) -    d.append(min(l, r)) -print((min(d))) +print( +    ( +        min( +            [ +                min(abs(cans[n]), abs(cans[n + (K - 1)])) +                + abs(cans[n + (K - 1)] - cans[n]) +                for n in range(N - K + 1) +            ] +        ) +    ) +)