import numpy as np

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

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

x = b[0]-b[1]+1

res = 10**15

 

for i in range(x):

    tmp = i + b[1] - 1

    if res > (a[tmp]-a[i] + min(abs(a[i]),abs(a[tmp]))):

	    res = a[tmp]-a[i] + min(abs(a[i]),abs(a[tmp]))

        

print(res)
b = list(map(int, input().split()))

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

x = b[0]-b[1]+1

res = 10**15

 

for i in range(x):

    tmp = i + b[1] - 1

    if res > (a[tmp]-a[i] + min(abs(a[i]),abs(a[tmp]))):

	    res = a[tmp]-a[i] + min(abs(a[i]),abs(a[tmp]))

        

print(res)
import numpy as np

b = list(map(int, input().split()))
a = list(map(int, input().split()))
x = b[0] - b[1] + 1
res = 10**15
for i in range(x):
    tmp = i + b[1] - 1
    if res > (a[tmp] - a[i] + min(abs(a[i]), abs(a[tmp]))):
        res = a[tmp] - a[i] + min(abs(a[i]), abs(a[tmp]))
print(res)

b = list(map(int, input().split()))
a = list(map(int, input().split()))
x = b[0] - b[1] + 1
res = 10**15
for i in range(x):
    tmp = i + b[1] - 1
    if res > (a[tmp] - a[i] + min(abs(a[i]), abs(a[tmp]))):
        res = a[tmp] - a[i] + min(abs(a[i]), abs(a[tmp]))
print(res)

-import numpy as np -