(* O(n) *)
let find_fold_int f a n =
  let rec find a i =
    if i >= n then
      a, false
    else
      let (res, detected) as r = f a i in
        if detected then r else find res (i + 1)
  in
    find a 0

(* O(n^2) *)
let solve n y =
  find_fold_int
    (fun sofar_a a ->
      find_fold_int
        (fun sofar_b b ->
          let c = n - a - b in
          if 10000 * a + 5000 * b + 1000 * c = y then
            (a, b, c), true
          else
            sofar_b, false)
        sofar_a
        (n - a + 1))
    (-1, -1, -1)
    (n + 1) |> fst

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  match read_ints () with
  | [n; y] -> let (a, b, c) = solve n y in Printf.printf "%d %d %d\n" a b c
  | _ -> ()