local n,k=io.read("n","n")
local x={}
for i=1,n do
    x[i]=io.read("n")
end

local min=math.maxinteger
for i=1,n-k+1 do
    local l=i
    local r=k+i-1
    local ltor=math.abs(x[l])+math.abs(x[r]-x[l])
    local rtol=math.abs(x[r])+math.abs(x[r]-x[l])
    min=math.min(min,ltor,rtol)
end
print(min)