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



X = []

idx = 0

for i,x in enumerate(input().split()):

    x = int(x)

    X.append(x)

    if x < 0:

        idx = i + 1

if idx == N:

    idx = N-1

ans = 10**9

for i in range(max(0,idx-K), min(N-K+1,idx+K)):

    tmp = 0

    if i <= idx <= i+K-1 or i >= idx or i+K-1 <= idx:

        tmp = min(abs(X[i]), abs(X[i+K-1]))

    # print(i,tmp)

    ans = min(ans, X[i+K-1] - X[i] + tmp)

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

X = []

idx = 0

for i,x in enumerate(input().split()):

    x = int(x)

    X.append(x)

    if x < 0:

        idx = i + 1

if idx == N:

    idx = N-1

ans = 10**9

for i in range(max(0,idx-K), min(N-K+1,idx+K)):

    ans = min(ans, X[i+K-1] - X[i] + min(abs(X[i]), abs(X[i+K-1])))

print(ans)
N, K = list(map(int, input().split()))
X = []
idx = 0
for i, x in enumerate(input().split()):
    x = int(x)
    X.append(x)
    if x < 0:
        idx = i + 1
if idx == N:
    idx = N - 1
ans = 10**9
for i in range(max(0, idx - K), min(N - K + 1, idx + K)):
    tmp = 0
    if i <= idx <= i + K - 1 or i >= idx or i + K - 1 <= idx:
        tmp = min(abs(X[i]), abs(X[i + K - 1]))
    # print(i,tmp)
    ans = min(ans, X[i + K - 1] - X[i] + tmp)
print(ans)

N, K = list(map(int, input().split()))
X = []
idx = 0
for i, x in enumerate(input().split()):
    x = int(x)
    X.append(x)
    if x < 0:
        idx = i + 1
if idx == N:
    idx = N - 1
ans = 10**9
for i in range(max(0, idx - K), min(N - K + 1, idx + K)):
    ans = min(ans, X[i + K - 1] - X[i] + min(abs(X[i]), abs(X[i + K - 1])))
print(ans)

-    tmp = 0 -    if i <= idx <= i + K - 1 or i >= idx or i + K - 1 <= idx: -        tmp = min(abs(X[i]), abs(X[i + K - 1])) -    # print(i,tmp) -    ans = min(ans, X[i + K - 1] - X[i] + tmp) +    ans = min(ans, X[i + K - 1] - X[i] + min(abs(X[i]), abs(X[i + K - 1])))