(* O(n^2) *)
let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let _ =
  for x = 0 to n do
    for y = 0 to n - x do
      let z = n - x - y in
      if 10000 * x + 5000 * y + 1000 * z = m then (Printf.printf "%d %d %d \n" x y z; exit 0) done done;
  print_endline "-1 -1 -1"