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

func main() {
    let line = readInts()
    let count = line[0]
    let amount = line[1]
    var count10000 = -1
    var count5000 = -1
    var count1000 = -1
    loop: for a in (0...count).reversed() {
        if count < a {
            continue
        }
        if amount < a * 10000 {
            continue
        }
        for b in (0...count).reversed() {
            if count < a + b {
                continue
            }
            if amount < (a * 10000) + (b * 5000) {
                continue
            }
            for c in (0...count).reversed() {
                if count < a + b + c {
                    continue
                }
                if ((a * 10000) + (b * 5000) + (c * 1000)) == amount {
                    count10000 = a
                    count5000 = b
                    count1000 = c
                    break loop
                }
            }
        }
    }
    print("\(count10000) \(count5000) \(count1000)")
}

main()