main :: IO()
main = do
  [a, b] <- map (read :: String -> Int) . words <$> getLine
  putStrLn $ unwords $ map show $ solve [(l,m,n) | l <- [0..a], m <- [0..(a-l)], let n = a - l -m, 10000*l+5000*m+1000*n==b]

solve :: [(Int, Int, Int)] -> [Int]
solve [] = [-1, -1, -1]
solve ((l, m, n) : xs) = [l, m, n]