main :: IO ()
main = do
  [n, y] <- map read . words <$> getLine :: IO [Int]
  let ans = filter (not . null) $ solve n (y `div` 1000)
  if null ans
    then putStrLn "-1 -1 -1"
    else putStrLn $ unwords $ map show $ head ans

solve n y = let max' = head $ filter ((<= y) . (* 10))
                       [n, n-1 .. 0]
            in do
  i <- [0 .. max']
  j <- [0 .. n - max']
  if y == (10 * i) + 5 * j + (n - i - j)
    then return [i, j, n-i-j]
    else return []
