fun main(args: Array<String>) {
    val numbers = readLine()
        ?.split(" ")
        ?.map { it.toInt() }
        ?: return
    val totalCount = numbers[0]
    val expectedAmount = numbers[1]

    for (i in 0..totalCount) {
        for (j in 0..(totalCount - i)) {
            val k = totalCount - (i + j)
            if (k < 0) {
                continue
            }
            val amount = 10000 * i + 5000 * j + 1000 * k
            if (amount == expectedAmount) {
                println("$i $j $k")
                return
            }
        }
    }
    println("-1 -1 -1")
}