You've had 2 periods and you've had early sonograms (which are most accurate in dating pregnancy compared to sonos done in later pregnancy).
I would say that it is more likely the ex-boyfriends. Unless you had sex with your exhusband after you left him there really is no way. The only way if you have doubts is to get a paternity test.
If you had your period on October 10th, then you would have conceived roughly two weeks after that, making it around October 24th. There is no way it could be your ex-husband's baby.
You had your period after you slept with your boyfriend.
Who did you sleep with between your Oct 10th period and the time you were due to start your Nov one? That person would be the father.
DR base your pregnancy stage from your LMP, but your babies age is normally 2 weeks less than that.
Are you now 25 weeks 4 days preg?
This would mean you roughly conceived on 20th OCT.
Who did you sleep with around that time?
If you are finding it hard to work it out a paternity test will help you when the baby is born.
I agree with nickie. Based on your dates it's unlikely your ex husband is the father. The only way to know for certain is through dna testing.
I seriously doubt that the baby is your ex husbands, but you can always have a paternity test when your baby is born to make extra sure. Best of luck!