main :: IO ()
main = do
  [n, y] <- map read . words <$> getLine
  putStr . unwords . map show $ solve n y

solve :: Int -> Int -> [Int]
solve n y = modify n y $ optimize y

optimize :: Int -> [Int]
optimize y = [a, b, c]
  where
    (a, r) = y `divMod` 10000
    (b, q) = r `divMod` 5000 
    c = q `div` 1000

modify :: Int -> Int -> [Int] -> [Int]
modify n y [a, b, c]
  | n == s = [a, b, c]
  | n - s >= 4 && b > 0 = modify n y [a, b - 1, c + 5]
  | n - s >= 0 && a > 0 = modify n y [a - 1, b + 2, c]
  | otherwise = [-1, -1, -1]
  where
    s = sum [a, b, c]


