let () = Scanf.scanf "%d %d" (fun n y ->
  try
    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 begin
          Printf.printf "%d %d %d\n" i j (n - i - j);
          raise Not_found
        end
      done
    done;
    print_endline "-1 -1 -1"
  with Not_found -> ())