import Control.Applicative
import Control.Monad

solver :: Int -> Int -> [Int]
solver n y =
    let xs = [(a, b) | a <- [0..n], b <- [0..(n-a)], 10000*a+5000*b+1000*(n-a-b) == y]
        in solver' xs n

solver' :: [(Int, Int)] -> Int -> [Int]
solver' []          _ = [-1, -1, -1]
solver' ((a, b):xs) n = [a, b, n-a-b]

main :: IO ()
main = do
    (n:y:_) <- (map read) . words <$> getLine
    putStrLn (unwords (map show (solver n y)))
