N, K = [int(i) for i in input().split()]

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



mi = 1e10

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

    r = l + K - 1

    mi = min(mi, abs(X[l]) + abs(X[r] - X[l]), abs(X[r]) + abs(X[r] - X[l]))

print(mi)
N, K = [int(i) for i in input().split()]

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



print((min(r - l + min(abs(l), abs(r)) for l, r in zip(X, X[K - 1:]))))

N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
mi = 1e10
for l in range(N - K + 1):
    r = l + K - 1
    mi = min(mi, abs(X[l]) + abs(X[r] - X[l]), abs(X[r]) + abs(X[r] - X[l]))
print(mi)

N, K = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
print((min(r - l + min(abs(l), abs(r)) for l, r in zip(X, X[K - 1 :]))))

-mi = 1e10 -for l in range(N - K + 1): -    r = l + K - 1 -    mi = min(mi, abs(X[l]) + abs(X[r] - X[l]), abs(X[r]) + abs(X[r] - X[l])) -print(mi) +print((min(r - l + min(abs(l), abs(r)) for l, r in zip(X, X[K - 1 :]))))