object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN, datY) = readLine.split(" ").map(_.toInt)

    for (x <- 0 to datN; y <- 0 to (datN - x)) {
      val z = datN - x - y
      val sum = x * 1000 + y * 5000 + z * 10000
      if (sum == datY) {
        println(z + " " + y + " " + x)
        return
      }
    }
    println("-1 -1 -1")
  }
}
