import scala.io.StdIn


object Main extends App {
  val Array(n, y)  = StdIn.readLine.split(" ").map(_.toInt)

  def solve(n: Int, y: Int) : String  = {
    var cnt = 0
    for(i <- 0 to n; j <- 0 to n - i) {
      val k = n - i - j
      val sum = i * 1000 + j * 5000 + k * 10000
      if (y == sum) return k + " " + j + " " +  i
    }
    "-1 -1 -1"
  }
  println(solve(n, y))

}
  

