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

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

ans=abs(a[0])*2+abs(a[-1])*2#とりあえず最大

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

  x,y=a[i],a[i+k-1]

  if x*y<0:m=min(abs(x),y)*2+max(abs(x),y)

  else:m=max(abs(x),abs(y))

  ans=min(ans,m)

print(ans)
n,k=list(map(int,input().split()))

k-=1

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

print((min(min(abs(x[i])+abs(x[i+k]-x[i]),abs(x[i+k])+abs(x[i+k]-x[i])) for i in range(n-k))))
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = abs(a[0]) * 2 + abs(a[-1]) * 2  # とりあえず最大
for i in range(n - k + 1):
    x, y = a[i], a[i + k - 1]
    if x * y < 0:
        m = min(abs(x), y) * 2 + max(abs(x), y)
    else:
        m = max(abs(x), abs(y))
    ans = min(ans, m)
print(ans)

n, k = list(map(int, input().split()))
k -= 1
x = list(map(int, input().split()))
print(
    (
        min(
            min(abs(x[i]) + abs(x[i + k] - x[i]), abs(x[i + k]) + abs(x[i + k] - x[i]))
            for i in range(n - k)
        )
    )
)

-a = list(map(int, input().split())) -ans = abs(a[0]) * 2 + abs(a[-1]) * 2  # とりあえず最大 -for i in range(n - k + 1): -    x, y = a[i], a[i + k - 1] -    if x * y < 0: -        m = min(abs(x), y) * 2 + max(abs(x), y) -    else: -        m = max(abs(x), abs(y)) -    ans = min(ans, m) -print(ans) +k -= 1 +x = list(map(int, input().split())) +print( +    ( +        min( +            min(abs(x[i]) + abs(x[i + k] - x[i]), abs(x[i + k]) + abs(x[i + k] - x[i])) +            for i in range(n - k) +        ) +    ) +)