let main () =
  let n, y = Scanf.sscanf (read_line ()) "%d %d" (fun a b -> (a, b)) in
  let numOf10000 = ref (-1) in
  let numOf5000 = ref (-1) in
  let numOf1000 = ref (-1) in
  (
    for i = 0 to n do
      for j = 0 to n - i do
        let k = n - i - j in
        let sum = 10000 * i + 5000 * j + 1000 * k in
        if sum = y
        then
          (
            numOf10000 := i;
            numOf5000 := j;
            numOf1000 := k
          )
      done
    done;
    Printf.printf "%d %d %d" !numOf10000 !numOf5000 !numOf1000;
    print_newline ()
  )

let _ = main ()
