confused.

Ronisha
I'm confused on how this pregnancy works.  I had unprotected sex with my boyfriend on the 26th of November 2016 and it knocked my period on that same day, lasted for 5 days. I didn't have a period for December 2016. I found out I was 5 weeks pregnant on the 31st of December 2016. How did I wind up pregnant if I had a period in November 2016? Any answer? I'm just confused on how it works. Supposedly your supposed to have sex on the days you ovulate to get pregnant.