Need Advice.

So my boyfriend and I had sex twice on 04/17 and three times on 04/18, unprotected sex every time but he pulled out.... but horrible mistake cause I regret it all cause now I'm terrified if I'll get pregnant and I want to buy the Plan B Pill, will it help prevent any pregnancy since I'll be taking it two days later.?