object Main extends App {
  val Array(n, y) = readLine.split(" ").map(_.toInt)
  
  val patterns = for {
    a <- (0 to n).toSeq
    b <- (0 to n).toSeq
    c = n - a - b
    if c >= 0
    if 10000 * a + 5000 * b + 1000 * c == y
  } yield Seq(a, b, c)
  
  val pattern = patterns.headOption.getOrElse(Seq(-1, -1, -1))
  
  println(pattern.mkString(" "))
}