You do risk pregnancy when a man/boy thrusts his penis into your vagina even if just the head. They emit pre ejaculation that has enough sperm to cause pregnancy. But the morning after pill will take care of that. I would not worry. However, understand that the morning after pill is considered emergency contraception. It's not to be used very often. It's a whopping dose of hormones and it WILL mess up your cycle. You will most likely be irregular for the next 2 to 3 months/cycles and sometimes longer and you won't know when you will next ovulate. So, you should talk to your doctor or go to a clinic for birth control. Either take oral contraceptives or make sure to have condoms available at all times. good luck
I don't want to be a party pooper, because it sounds like you took all the corrective measures you could after doing a dumb thing, but you should also know that the morning-after pill has a 1-in-8 chance of not working. If you are not interested in getting pregnant, naked penis heads have NO business in your vagina. (Let's not even think about sexually-transmitted disease.) So, don't just be "extra careful" next time, don't do anything with a bare penis. Use condoms and get on the Pill or get an IUD.
Time for birth control here are some great options