getConbination :: Int -> Int -> (Int, Int, Int)
getConbination n y = head ([(a, b, n-a-b) | a <- [0..n], b <- [0..n-a], 10000*a+5000*b+1000*(n-a-b) == y] ++ [(-1, -1, -1)])

showAnswer :: (Int, Int, Int) -> String
showAnswer (a, b, c) = show a ++ " " ++ show b ++ " " ++ show c

toInt :: String -> Int
toInt = read :: String -> Int

main = do
  [n, y] <- map toInt . words <$> getLine
  putStrLn $ showAnswer $ getConbination n y