Why are you stressing? You’re in 9th grade and you’re being challenged - and nothing wrong with a B.
You may not find yourself in a UC or Ivy - too early to say - but then - so what? You’d be elsewhere.
Your future is not secure because you go to an Ivy or UC and your future isn’t a train wreck if you go somewhere else.
Forget the grades - make sure you learn these subjects because they build on one another. Get involved after school - club, sports, etc.
And be the best you.
In two years, you’ll be able to better assess where you are - UCs, Ivy, or otherwise.
Good luck.