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

main = do
  [n, y] <- map read . words <$> getLine :: IO [Int]
  let (a,b,c) = head $ solve n y
  putStr $ show a ++ " "
  putStr $ show b ++ " "
  putStrLn $ show c