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


takeN :: Int -> [Int] -> [[Int]]
takeN k xs | length xs < k = []
           | otherwise     = take k xs : takeN k (tail xs)

cost :: [Int] -> Int
cost xs = let mn = - (foldl' min 0 $ filter (< 0) xs)
              mx = foldl' max 0 $ filter (> 0) xs
          in (mn * 2 + mx) `min` (mx * 2 + mn)


main = do [n, k] <- getInts
          xs <- getInts
          let res = minimum [ cost as | as <- takeN k xs ]
          print res
