fun main(args: Array<String>) {
    val (n, coin) = readLine()!!.split(" ").map(String::toInt)
    var noAnser = true
    loop@for (i in n downTo 0) {
            for (j in (n-i) downTo 0) {
                val z = n-i-j
                if (0 <= z && z <= n) {
                    if (coin == (i*10000 + j*5000 + z*1000)){
                        println("${i} ${j} ${z}")
                        noAnser = false
                        break@loop
                    }       
                } 
            }
        }
    if (noAnser) {
        println("-1 -1 -1")
    }
}