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]
    (ps,ms)<-partition (>=0).unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine
    --
    print $ minimum $ solve k ps $ reverse ms
--
solve k ps [] = [ps !! (k-1)]
solve k [] ms = [negate $ ms !! (k-1)]
solve k pa@(p:ps) ms
    | p == 0 = solve' (k-1) ps ms
    | True   = solve' k pa ms
--
solve' 0 _ _ = [0]
solve' k ps ms =  (pp:) $ (mm:) $ concatMap (\i -> [f i, g i]) [max 1 k-(length ms)..min (k-1) (length ps)]
    where
        pv = V.fromList ps
        mv = V.fromList ms
        pp = (ps ++ (repeat (10^5))) !! (k-1)
        mm = negate $(ms ++ (repeat $ negate $ 10^5)) !! (k-1)
        f i = (pv V.! (i-1))*2 - (mv V.! (k-i-1))
        g i = (pv V.! (i-1)) - (mv V.! (k-i-1))*2 