import Control.Monad
import Data.List
main = do
  [_,k] <- map read . words <$> getLine
  xs <- map read . words <$> getLine
  print $ minimum (map solve $ pair k xs)
 
pair k xs = [ (a,b)
	| x <- [0..(length xs - k)]
	, let a = (xs !! x)
	, let b = (xs !! (x+(k-1)))]

solve (a,b)
  | a < 0 && b < 0  = (abs a) * 2
  | a < 0 && 0 <= b = 2*(min (abs a) b) + max (abs a) b
  | otherwise       = b * 2