import java.security.KeyStore.TrustedCertificateEntry
import java.util
import java.util.regex.Pattern
import java.util.{ArrayList, Collections, Comparator, List => JList}

import scala.math._
import scala.collection.mutable
import scala.collection.mutable.{ArrayBuffer, ListBuffer}
import scala.util.{Failure, Success, Try}

object Main{
  val LINE_SEPARATOR = "\n"
  def main(args: Array[String]): Unit = {
    if (sys.env.getOrElse("TEST", "")=="1"){
      println(test());
    }else{
      val input=io.Source.stdin.getLines().mkString(LINE_SEPARATOR);
      println(solve(input).trim());
    }
  }

  def init (nRows: Int, nCols: Int, default: Int) = Array.tabulate(nRows,nCols)( (x,y) =>  default)

  def sortIgnoreCase1(list: JList[String]): JList[String] = {
    val r = new ArrayList[String](list)
    Collections.sort(r, new Comparator[String] {
      override def compare(o1: String, o2: String): Int = o1.compareToIgnoreCase(o2)
    })
    r
  }

  def solve(input: String): String = {
    val n = input.split(" ").head.toInt
    val y = input.split(" ").tail.head.toLong
//    (for (i <- 0 to n; j <- 0 to n-i) yield Vector(i, j, n - i - j)).toVector
//      .find(x => 10000L * x(0) + 5000L * x(1) + 1000L * x(2) == y)
//      .getOrElse(Vector(-1L, -1L, -1L))
//      .mkString(" ")

    (0 to n).flatMap{i =>
      (0 to n - i).map{j =>
        val k = n - i - j
        val ycand = 10000L * i + 5000L * j + 1000L * k
        if (ycand == y) (i, j, k) else (-1,-1,-1)
      }
    }.iterator.find(_._1 != -1).map(x => List(x._1, x._2, x._3)).getOrElse(List(-1, -1, -1)).mkString(" ")
  }

  def divisors(n: Long): Vector[Long] = {
    val halfList = (1 to sqrt(n).toInt).toVector.filter(_ % n == 0).map(_.toLong)
    val reversedList = if (sqrt(n).floor == sqrt(n)) halfList.reverse.tail.map(n/_) else halfList.reverse.map(n/_)
    halfList ++ reversedList
  }

  def gcd(m: Long, n: Long): Long = n match {
    case 0 => m
    case _ => gcd(n, m % n)
  }
  def lcm(a: Long, b: Long): Long = a * b / gcd(a, b)

  val tests=List(
    """9 45000""".stripMargin -> """4 0 5
                                   |""".stripMargin,
    """20 196000""".stripMargin -> """-1 -1 -1
                                     |""".stripMargin,
    """2000 20000000""".stripMargin -> """2000 0 0"""
  )

  def test():String= {
    return tests.map{case (i,o)=>(i.trim(),o.trim())}
      .zipWithIndex.map{
      case ((input,outputExpect),i)=>{
        val output=solve(input).trim();
        s"test${i+1}:"+(if(output==outputExpect){
          "Passed"
        }else{
          s"Failed\nexpect:\n${outputExpect}\noutput:\n${output}"
        })
      }}
      .mkString("\n");
  }
}