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

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)
