import java.util.Scanner

import scala.util.control.Breaks

object Main extends App {

  val b = new Breaks

  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  val y = sc.nextInt()

  b.breakable {
    for (itiman <- 0 to n) {
      for (gosen <- 0 to n - itiman) {
        for (sen <- 0 to n - itiman - gosen) {
          if (y == itiman * 10000 + gosen * 5000 + sen * 1000) {
            println(s"$itiman $gosen $sen")
            b.break()
          }
        }
      }
    }
    println("-1 -1 -1")
    b.break()
  }
}
