import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = solve <$> f <*> f >>= print
  where
    f = readil B.readInt <$> B.getLine

solve :: [Int] -> [Int] -> Int
solve [n, k] xs = f 1000000000 xs (drop (k-1) xs)
  where
    f t _ [] = t
    f t (y:ys) (z:zs)
      | y * z >= 0 = f (min t (max (abs y) (abs z))) ys zs
      | otherwise = f (min t (max (abs y) (abs z) + 2 * (min (abs y) (abs z)))) ys zs

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr g
  where
    g s = do
      (n, s') <- f s
      return (n, B.dropWhile isSpace s')
