Sex pain

I haven’t had sex since June, when I finally have sex yesterday for the first time in nine months it’s so painful why? Like isn’t sex supposed to be good why is it so painful.