let rec seq a b = if a > b then [] else a :: seq (a+1) b
let (>>=) x f = List.map f x |> List.concat
let () =
  Scanf.scanf "%d %d" @@ fun n y ->
    (seq 0 n >>= fun i ->
     seq 0 (n-i) >>= fun j ->
       if 10000*i + 5000*j + 1000*(n-i-j) = y then [i, j, n-i-j] else [])
    |> function
      | (i,j,k)::_ -> Printf.printf "%d %d %d\n" i j k
      | [] -> print_endline "-1 -1 -1"