import Control.Arrow

main :: IO ()
main = readParams >>= putStrLn . format . uncurry solve

readParams :: IO (Int, [Int])
readParams = (last &&& init) . map read . words <$> getLine

format :: Show a => [a] -> String
format = unwords . map show

solve :: Int -> [Int] -> [Int]
solve k = map fst . tail . scanl f (0, k)

f :: (Int, Int) -> Int -> (Int, Int)
f (_, x) y = (max (y - x) 0, max (x - y) 0)
