import Control.Monad
import Data.List
import Control.Arrow

getInts :: IO [Int]
getInts = do s <- getLine
             return $ map read $ words s

getLines :: Int -> IO [String]
getLines n = replicateM n $ getLine

solve k as bs = let ks  = take k $ sort ([ (a, True) | a <- as ] ++ [ (2 * b, False) | b <- bs ])
                    amx = foldl' max 0 [ a | (a, c) <- ks, c == True ]
                    bmx = foldl' max 0 [ b | (b, c) <- ks, c == False ]
                in amx + bmx


main = do [n, k] <- getInts
          xs <- getInts
          let as = [ -x | x <- xs, x < 0 ]
          let bs = [ x | x <- xs, x >= 0 ]
          print (solve k as bs `min` solve k bs as)
