Assuming this is a simple interest situation:
The 8.75% account will earn (0.0875)(5000) each year.
$437.5 earned per year
The 9.5 % account will earn (0.095)(7000) each year
$665 earned per year
Together, these accounts earn $1102.5 per year.
If x is the number of years until the desired interest is earned, then you need to solve 1102.5x = 8820. Dividing by 1102.5 on both sides, you find x=8.
Again, assuming this is simple interest and not compound interest, it will take 8 years.