import scala.io.StdIn._

object Main extends App {
  val Array(n, y) = readLine().split(" ").map(_.toInt)
  var num = n
  var yen = y
  var counts: List[Int] = List()

  for (b <- List(10000, 5000, 1000)) {
    val t = yen / b
    num -= t
    yen -= t * b
    counts = t :: counts
  }

  if (num >= 0 && yen >= 0) println(counts.reverse.mkString(" "))
  else println("-1 -1 -1")
}
