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) yield {
    val z = n - (x + y)
    if (total == (x * 10000 + y * 5000 + z * 1000)) (x, y, z)
  }

  val confirmed = combinations.dropWhile(_ == ())

  val ans = confirmed.head match {
    case () => "-1 -1 -1"
    case (x, y, z) => s"$x $y $z"
  }

  println(ans)
}
