import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,k] <- getIntList
    xs <- getIntList
    let (ms,ys) = span (< 0) xs
        (zs,ps) = span (==0) ys
        m = length ms
        z = length zs
        p = length ps
        kp = drop (k-z-m) . (0:) $ take k ps
        km = reverse . drop (k-z-p) . (0:) $ take k (reverse ms)
    print . minimum $ zipWith (\a b -> min (a-2*b) (2*a-b)) kp km