    fun main(args: Array<String>) {
        val input = read()
        println(otoshidama(input))
    }

    data class Inputs(val count: Int, val total: Int)
    data class Outputs(val yukichi: Int, val ichiyo: Int, val hideyo: Int) {
        override fun toString(): String {
            return "$yukichi $ichiyo $hideyo"
        }
    }

    fun read(): Inputs {
        val inputs = readLine()!!.split(' ').map { Integer.parseInt(it) }
        return Inputs(inputs[0], inputs[1])
    }

    fun otoshidama(inputs: Inputs): Outputs {
        (0..inputs.count).forEach { yukichi ->
            (0..inputs.count - yukichi).forEach { ichiyo ->
                val hideyo = inputs.count - yukichi - ichiyo
                val sum = yukichi * 10000 + ichiyo * 5000 + hideyo * 1000
                if (inputs.total == sum) return Outputs(yukichi, ichiyo, hideyo)
            }
        }
        return Outputs(-1, -1, -1)
    }