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

f :: [[Int]] -> String
f [] = "-1 -1 -1"
f list = unwords . map show $ head list
