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

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

ans = 10**9

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

    if x[i]*x[i-k+1]<0:

        mn = min(abs(x[i-k+1]),abs(x[i]))

        mx = max(abs(x[i-k+1]),abs(x[i]))

        ans = min(ans,2*mn+mx)

    else:

        ans = min(ans, max(abs(x[i-k+1]),abs(x[i])))

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

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

ans = 10**18

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

    l = x[i]

    r = x[i+k-1]

    if r<=0:

        ans = min(ans,abs(l))

    if l*r<0:

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

    if l>=0:

        ans = min(ans,r)

print(ans)
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**9
for i in range(k - 1, n):
    if x[i] * x[i - k + 1] < 0:
        mn = min(abs(x[i - k + 1]), abs(x[i]))
        mx = max(abs(x[i - k + 1]), abs(x[i]))
        ans = min(ans, 2 * mn + mx)
    else:
        ans = min(ans, max(abs(x[i - k + 1]), abs(x[i])))
print(ans)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10**18
for i in range(n - k + 1):
    l = x[i]
    r = x[i + k - 1]
    if r <= 0:
        ans = min(ans, abs(l))
    if l * r < 0:
        ans = min(ans, min(abs(l), abs(r)) + r - l)
    if l >= 0:
        ans = min(ans, r)
print(ans)

-ans = 10**9 -for i in range(k - 1, n): -    if x[i] * x[i - k + 1] < 0: -        mn = min(abs(x[i - k + 1]), abs(x[i])) -        mx = max(abs(x[i - k + 1]), abs(x[i])) -        ans = min(ans, 2 * mn + mx) -    else: -        ans = min(ans, max(abs(x[i - k + 1]), abs(x[i]))) +ans = 10**18 +for i in range(n - k + 1): +    l = x[i] +    r = x[i + k - 1] +    if r <= 0: +        ans = min(ans, abs(l)) +    if l * r < 0: +        ans = min(ans, min(abs(l), abs(r)) + r - l) +    if l >= 0: +        ans = min(ans, r)