module lib1

let allLines = seq{
    let mutable line = System.Console.ReadLine()
    while line <> null do
        yield line
        line <- System.Console.ReadLine()
}

let getSum y =
    let a = y / 10
    let b = y % 10 / 5
    let c = y % 10 % 5
    (a, b, c)


let mutable line = System.Console.ReadLine()

let data = 
    line.Split(' ')

let N = int data.[0]
let y = int data.[1] / 1000

if N * 10 < y || N > y then System.Console.WriteLine("-1 -1 -1")
else
    let mutable a, b, c = getSum y
    let mutable diff = N - (a + b + c)
    if diff = 0 then printf "%d %d %d\n" a b c
    else
        let mutable dp = diff / 9
        if dp > a then dp <- a
        a <- a - dp
        c <- c + dp * 10
        diff <- diff - dp * 9

        dp <- diff / 4
        if dp > b then dp <- b
        b <- b - dp
        c <- c + dp * 5
        diff <- diff - dp * 4

        dp <- diff
        if dp > a then dp <- a
        a <- a - dp
        b <- b + dp * 2
        diff <- diff - dp

        if diff <> 0 || a < 0 || b < 0 || c < 0 then System.Console.WriteLine("-1 -1 -1")
        else printf "%d %d %d\n" a b c