let () =
  let n,y = Scanf.scanf "%d %d " (fun a b -> a,b) in

  let res = ref [-1; -1; -1] in
  for i=0 to n do
    for j=0 to n-i do
      for k=0 to n-i-j do
        if 10000 * i + 5000 * j + 1000 * k = y then
          res := [i;j;k]
        else ()
      done;
    done;
  done;
  Printf.printf "%d %d %d\n" (List.nth !res 0) (List.nth !res 1) (List.nth !res 2)
