fun main(args: Array<String>) {
    val(N, Y) = readLine()!!.split(" ").map(String::toInt)
    var res1000 = -1
    var res5000 = -1
    var res10000 = -1
    for (a in 0..N) {
        for (b in 0..N-a) {
            val c = N - a - b
            val total = a*1000 + b*5000 + c*10000
            if (total == Y) {
                res1000 = a
                res5000 = b
                res10000 = c
            }
        }
    }
    println("$res10000 $res5000 $res1000")
}