HELP !

So i had my last period 04/22 & was having unprotected sex before i started my period (with my ex). On 05/30 i found out i was pregnant, doctor tells me it goes by the last day of my period but does that mean i was already pregnant before my last period started or after it ended (which im seeing my boyfriend now since 05/05) ?