import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe

bsReadInts :: B.ByteString -> [Int]
bsReadInts = map (fst . fromJust . B.readInt) . B.words

----------------------------------------------------------------------

solve :: Int -> Int -> [Int] -> Int
solve n k xs = minimum $ zipWith f xs (drop (k-1) xs)
  where
    f p q | q <= 0 = -p
          | p >= 0 = q
          | q <= (-p) = 2 * q + (-p)
          | (-p) <= q = 2 * (-p) + q


tmain :: B.ByteString -> Int
tmain cont =
  let n : k : xs = bsReadInts cont
  in solve n k xs

main = putStrLn . show . tmain =<< B.getContents
