let rec for5000 x n y i =
  if i > n then None
  else if (y - i * 5000) >= 0 && (n - i) * 1000 >= (y - i * 5000)
  then Some (x ,i, n-i) else None

let rec for10000 n y i =
  if i > n then None 
  else match for5000 i (n - i) (y - i * 10000) 0 with
       | None -> for10000 n y (i + 1)
       | Some x -> Some x

let solve n y = for10000 n y 0

let _ =
  let n, y = Scanf.scanf "%d %d\n" (fun n y -> n, y) in
  match solve n y with
  | None -> print_string "-1 -1 -1"
  | Some (x, y, z) -> Printf.printf "%d %d %d" x y z
