main = do
  [n, y] <- map read . words <$> getLine
  putStrLn . unwords . map show $ head ([[i, j, k] | i <- [0 .. n], j <- [0 .. n - i],
    let k = n - i - j, 10000 * i + 5000 * j + 1000 * k == y] ++ [[-1, -1, -1]])