let main () =
  let n, x = Scanf.scanf "%d %d\n" (fun a b -> a, b) in
  let xs = ref [] in
  for i = 0 to n do
    for j = 0 to n do
      if i + j <= n then xs := (i,j, n - (i+j)) :: !xs;
    done;
  done;
  List.iter (fun (i,j,k) -> if 10000 * i + 5000 * j + 1000 * k = x then (Printf.printf "%d %d %d\n" i j k; exit 0)) !xs;
  Printf.printf "-1 -1 -1\n"

let _ = main ()
