object Main extends App {
  val input = scala.io.StdIn.readLine().split(" ").map(_.toInt)
  val n = input(0)
  val total = input(1)

  val combinations = for (x <- 0 until n; y <- 0 until n; z <- 0 until n
                          if (total - (x * 10000 + y * 5000 + z * 1000) == 0) && x + y + z == n) yield {
    (x, y, z)
  }

  val ans = if (combinations == Vector()) {
    "-1 -1 -1"
  } else {
    val x = combinations(0)._1
    val y = combinations(0)._2
    val z = combinations(0)._3
    s"$x $y $z"
  }

  println(ans)
}
