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
        pairs = [(((0:(reverse ms)) !! i), ((0:ps) !! (k-z-i)))|i <- [0..m], 0 <= k-z-i, k-z-i <= p]
    print . minimum $ map (\(x,y) -> min (y-2*x) (2*y-x)) pairs
    print pairs