program main
implicit None
	integer(8)::n,k,i,p,q
	integer(8),allocatable::x(:)
	
	read *,n,k
	allocate(x(n))
	
	read *,x
	
	do i = 1,n-k+1
		if(abs(x(i)) < abs(x(i+k-1)))then
			q = abs(x(i))
			else
			q = abs(x(i+k-1))
		endif
		q = x(i+k-1)-x(i)+q
		if(i == 1 .or. p > q) p = q
	enddo
	
	print "(i0)",p
end program main