exception Exodus
let call_cc f =
  let return = ref (fun () -> raise Not_found) in
  try f (fun x -> (return := fun () -> x); raise Exodus)
  with Exodus -> !return ()

let () = print_endline @@ Scanf.scanf "%d %d" (fun n y ->
  call_cc (fun k ->
    for i = 0 to min n ((y / 1000 - n) / 9) do
      for j = 0 to min (n - i) ((y / 1000 - n - 9 * i) / 4) do
        if 9 * i + 4 * j = y / 1000 - n then
          k (Printf.sprintf "%d %d %d" i j (n - i - j))
      done
    done;
    "-1 -1 -1"))