Boyfriend’s ex keeps coming in my mind

Hi all. So I recently found out about a girl who my boyfriend used to date. I know who she is and I know this shouldn’t affect my relationship at all with my boyfriend...but her thought keeps coming in my mind. To think the stuff he may have done with her is grossing me out. To think that at some point he loved her while he’s my first love ever...it’s painful to say the least.

I know I’m being irrational, and I’m trying to get rid of these dumb thoughts. What can I do to eradicate them? Some useful tips would be well appreciated.