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

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



ans = 10**18

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

    D = X[l + K - 1] - X[l]

    if X[l] <= 0 <= X[l + K - 1]:

        D += min(-X[l], X[l + K - 1])

    elif X[l + K - 1] <= 0:

        D += -X[l + K - 1]

    elif X[l] >= 0:

        D += X[l]

    ans = min(ans, D)

print(ans)

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

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



ans = 10**18

for l, r in zip(X, X[K - 1:]):

    if r <= 0:

        ans = min(ans, abs(l))

    if l >= 0:

        ans = min(ans, abs(r))

    if l < 0 < r:

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

print(ans)

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**18
for l in range(N - K + 1):
    D = X[l + K - 1] - X[l]
    if X[l] <= 0 <= X[l + K - 1]:
        D += min(-X[l], X[l + K - 1])
    elif X[l + K - 1] <= 0:
        D += -X[l + K - 1]
    elif X[l] >= 0:
        D += X[l]
    ans = min(ans, D)
print(ans)

N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**18
for l, r in zip(X, X[K - 1 :]):
    if r <= 0:
        ans = min(ans, abs(l))
    if l >= 0:
        ans = min(ans, abs(r))
    if l < 0 < r:
        ans = min(ans, r - l + min(abs(r), abs(l)))
print(ans)

-for l in range(N - K + 1): -    D = X[l + K - 1] - X[l] -    if X[l] <= 0 <= X[l + K - 1]: -        D += min(-X[l], X[l + K - 1]) -    elif X[l + K - 1] <= 0: -        D += -X[l + K - 1] -    elif X[l] >= 0: -        D += X[l] -    ans = min(ans, D) +for l, r in zip(X, X[K - 1 :]): +    if r <= 0: +        ans = min(ans, abs(l)) +    if l >= 0: +        ans = min(ans, abs(r)) +    if l < 0 < r: +        ans = min(ans, r - l + min(abs(r), abs(l)))