func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

let ints = readInts()
let n = ints[0]
let sum = ints[1]
var remain = sum

let (x, y, z) = (10_000, 5_000, 1_000)

func countAndReduceRemain(by paper: Int, remain: Int) -> (count: Int, remain: Int) {
    guard remain > paper else {
        return (0, remain)
    }
    let count = remain / paper
    return (count, remain - count * paper)
}

let first = countAndReduceRemain(by: x, remain: remain)
let second = countAndReduceRemain(by: y, remain: first.remain)
let final = countAndReduceRemain(by: z, remain: second.remain)

if first.count + second.count + first.count == n {
    print("\(first.count) \(second.count) \(final.count)")
} else {
    print("-1 -1 -1")
}