local n, k = io.read("*n", "*n")
local left, right = {}, {}
for i = 1, n do
  local d = io.read("*n")
  if(d == 0) then k = k - 1
  elseif(0 < d) then table.insert(right, d)
  else table.insert(left, -d) end
end
table.sort(left)
table.sort(right)
local leftusemin = math.max(0, k - #right)
local leftusemax = math.min(k, #left)

local minlen = 0
for leftuse = leftusemin, leftusemax do
  local rightuse = k - leftuse
  local leftlen, rightlen = 0, 0
  if(0 < leftuse) then leftlen = left[leftuse] end
  if(0 < rightuse) then rightlen = right[rightuse] end
  local curlen = leftlen + rightlen + math.min(leftlen, rightlen)
  if(minlen == 0) then minlen = curlen else minlen = math.min(minlen, curlen) end
end
print(minlen)
