integer N,K
integer,allocatable,dimension(:)::x
integer l,r
integer ans,subans
read*,N,K
allocate(x(N))
read*,x
ans=huge(ans)
do i=1,N-K+1
  l=x(i);r=x(i+k-1)
  subans=min(abs(l),abs(r))+(r-l)
  ans=min(ans,subans)
end do
print"(I0)",ans
end