
main :: IO ()
main = do
  [n,yy] <- map read . words <$> getLine :: IO [Int]
  print . f $ [(x, y, z) | z <- [0..n], y <- [0..(n-z)], x <- [0..(n-z-y)], x+y+z == n && 10000*x + 5000*y + 1000*z == yy]

f :: [(Int, Int, Int)] -> String
f [] = "-1 -1 -1"
f list = f' $ head list
  where
    f' (a,b,c) = (show a) ++ " " ++ (show b) ++ " " ++ (show c)
