program candles
  implicit none
  integer :: n, k, x(100000) = 0, i, m = 1e9, p, q
  read(*,*) n, k
  read(*,*) x(1:n)
  do i = 1, n-k+1
    p = abs(x(i))
    q = abs(x(i+k-1))
    if (sign(1,x(i)) == sign(1,x(i+k-1))) then
      m = min(m,max(p,q))
    else
      m = min(m,max(p,q)+2*min(p,q))
    end if
  end do
  write(*,'(i0)') m
end program candles