let i_inp_list : unit -> int list = fun () ->
  let inp_split = Str.split (Str.regexp " ") (input_line stdin) in
  List.map (fun x -> int_of_string x) (inp_split)
  
let () =
  let (n, y) = Scanf.sscanf (input_line stdin) "%d %d" (fun a b -> (a, b)) in
  let solve =
    let rec loop_10000 i =
      if i > n || 10000 * i > y then None
      else
        match loop_5000 i 0 with
          None -> loop_10000 (i + 1)
        | Some x -> Some x
    and loop_5000 i j =
      if i + j > n || 10000 * i + 5000 * j > y then None
      else
        let k = (y - 10000 * i + 5000 * j) / 1000 in
        if i + j + k = n then Some (i, j, k)
        else loop_5000 i (j + 1)
    in
    match loop_10000 0 with
      None -> (-1,-1,-1)
    | Some (i,j,k) -> (i,j,k)
  in
  let (i, j, k) = solve
  in
  print_int i;
  print_char ' ';
  print_int j;
  print_char ' ';
  print_int k;
  print_newline ()
