program abc107c
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,k,i,l,r,ans
    integer(int32), allocatable:: x(:)

    read*, n,k
    allocate(x(n))
    read*, x(:)
    ans = 200000000
    do i=1,n-k+1
        l = x(i)
        r = x(i+k-1)
        ans = min(abs(l),abs(r)) + r-l
    end do
    print'(i0)', ans
end program abc107c