let NY: [Int] = readLine()!.characters.split(" ").map { Int(String($0))! }
var xRes: Int = -1
var yRes: Int = -1
var zRes: Int = -1

for x in 0...NY[0] {
    for y in 0...NY[0] {
        let z: Int = NY[0] - x - y
        if 0 <= z {
            let otoshidama: Int = 10000*x + 5000*y + 1000*z
            if otoshidama == NY[1] {
                xRes = x
                yRes = y
                zRes = z
            }
        }
    }
}
print(xRes, yRes, zRes)