import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
main=do
    (n:k:_)<-map read.words<$>getLine::IO[Int]
    xs<-unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine
    --
    print $ minimum $ if elem 0 xs then solve (k-1) (filter (/=0) xs) else solve k xs
--
solve 0 _ = [0]
solve k xs@(x:_)
    | x > 0 = [xs !! (k-1)]
    | la < 0 = [negate $ (reverse xs) !! (k-1)]
    | True = solve' k xs (drop (k-1) xs)
    where la = last xs

solve' _ _ [] = []
solve' k (l:ls) (r:rs)
    | r<0 = (solve' k ls rs)
    | l>0 = []
    | True = (min (r*2-l) (r-l*2) ) : (solve' k ls rs)