Period

I had my period in two times in July...July 1-5 then I had sex for the first time in a year ...then I had another period ...why is this does anybody know?