stdin.ReadLine().Split(' ') |> Array.map int |> function
| [|n; y|] ->
    [for man in 0..(min n (y / 10000)) do
        for gosen in 0..(min n (y / 5000)) do
            for sen in 0..(min n (y / 1000)) do
                yield man, gosen, sen]
    |> Seq.filter (fun (a, b, c) -> (a + b + c = n) && (a * 10000 + b * 5000 + c * 1000 = y))
    |> Seq.tryHead
    |> function
    | Some(a, b, c) -> printfn "%d %d %d" a b c
    | None -> printfn "-1 -1 -1"
| _ -> ()
