To be honest, not saying anything will only make it worse. However, I can understand your dilema (I doubt that is how it's spelled, but let's role with it). I have had some experience with self-esteem issues myself, and I have to tell you, you have yourself in a pretty bad situation. But when caught between a rock and a hard place, think laterally.
What I would do is tell Girl A the situation. Maybe not now, maybe not in such detail, but it is good to let her know that, and this would be perfect to say, a friend of yours is having a small problem right now and you're still thinking of how to fix it. When she asks what it is, tell her you would rather she did not get involved, because you believe it is your responsibility and you would rather it not spill out of control or escalate and hurt somebody, and you are concerned she might get hurt. Remember to tell her that you will tell her all about it eventually, hopefully when it is over, or you need to protect her from it, or when you need her help, (and by all means, do. She will remember).
Don't lie and tell the truth. Tell her what she needs to know so she knows there might be something on your mind and that case, if worse comes to worse, at least she knows you were trying to protect her.
And funny thing, that was the easy part.
Ok, because I am running out of time, I'll try to keep this brief.
Talk to Girl B. Make sure she understands how you feel. But, and this is incredibly important, make sure you give her some hope for the future. Let her know that there are still other guys out there, that you're here for her as a friend, and that you know she'll find a good guy for her. It may not be you, but maybe someone better. You don't know the future and neither does she, but you guys can't change the present or the past. Working to make the future better is all you can hope for. You don't know what will happen in her relationships, and neither does she. But you care enough to tell her that when she does find the guy for her, and she will, he will be the best thing that she ever found. And anyway, even if it's just a dream right now, a hope that may never come true, it is still better than moping over the past. tell her that you care to be her friend, but her boyfriend is still out there waiting for her.
Funny thing, and don't ask how I know this, but I'll bet it's true.