import qualified Data.ByteString.Char8 as B
import Data.Maybe

main = do
    [_, x] <- map read . words <$> getLine :: IO [Int]
    as <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine :: IO [Int]
    print . map (\n -> n-x) $ f as
    print . max 0 . g . map (\n -> n-x) $ f as

f (x:y:ns) = x+y : f (y:ns)
f _ = []

g (x:y:ns) = max x y + g ns
g [x] = x
g [] = 0