n,k,*a=list(map(int,open(0).read().split()));print((min([a[i+k-1]-a[i]+min(abs(a[i+k-1]),abs(a[i]))for i in range(n-k+1)])))
n,k,*a=list(map(int,open(0).read().split()));print((min([r-l+min(abs(l),abs(r))for l,r in zip(a,a[k-1:])])))
n, k, *a = list(map(int, open(0).read().split()))
print(
    (
        min(
            [
                a[i + k - 1] - a[i] + min(abs(a[i + k - 1]), abs(a[i]))
                for i in range(n - k + 1)
            ]
        )
    )
)

n, k, *a = list(map(int, open(0).read().split()))
print((min([r - l + min(abs(l), abs(r)) for l, r in zip(a, a[k - 1 :])])))

-print( -    ( -        min( -            [ -                a[i + k - 1] - a[i] + min(abs(a[i + k - 1]), abs(a[i])) -                for i in range(n - k + 1) -            ] -        ) -    ) -) +print((min([r - l + min(abs(l), abs(r)) for l, r in zip(a, a[k - 1 :])])))