let get_2_ints () = Scanf.scanf "%d %d" (fun u v -> u,v)

let () =
  let (n,y) = get_2_ints ()
  in let r = ref (-1,-1,-1)
  in
  for i=0 to n do
    for j=0 to n-i do
      let k = n-i-j
      in if i*10000+j*5000+k*1000=y then r:=(i,j,k)
    done
  done;
  !r |> (fun (u,v,w) -> Printf.printf "%d %d %d\n" u v w);
