n, m = list(map(int, input().split()))

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

su = []



for i in range(n):

    su.append(lis[i] - lis[0])



res = 10**9

for i in range(n - m + 1):

    res = min(res, su[i + m - 1] - su[i] + min(abs(lis[i]), abs(lis[i + m - 1])))

print(res)

n, m = list(map(int, input().split()))

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



res = 10**9

for i in range(n - m + 1):

    res = min(res, lis[i + m - 1] - lis[i] + min(abs(lis[i]), abs(lis[i + m - 1])))

print(res)

n, m = list(map(int, input().split()))
lis = list(map(int, input().split()))
su = []
for i in range(n):
    su.append(lis[i] - lis[0])
res = 10**9
for i in range(n - m + 1):
    res = min(res, su[i + m - 1] - su[i] + min(abs(lis[i]), abs(lis[i + m - 1])))
print(res)

n, m = list(map(int, input().split()))
lis = list(map(int, input().split()))
res = 10**9
for i in range(n - m + 1):
    res = min(res, lis[i + m - 1] - lis[i] + min(abs(lis[i]), abs(lis[i + m - 1])))
print(res)

-su = [] -for i in range(n): -    su.append(lis[i] - lis[0]) -    res = min(res, su[i + m - 1] - su[i] + min(abs(lis[i]), abs(lis[i + m - 1]))) +    res = min(res, lis[i + m - 1] - lis[i] + min(abs(lis[i]), abs(lis[i + m - 1])))