Welcome!
Here is what you do:
1) You download the correct file from the Pentax website. Extract/run the exe file on your computer. There is a readme, so read it. It is actually very detailed.
2) Once you extract everything, there will be a .bin file.
3) Put a fully charged battery into your camera. Go to menu, and format the card (everything on the card will be deleted). Turn the camera off.
4) Put the .bin file on the card. (you should probably use a card reader)
5) Put the card into the camera and follow the instructions in the readme.
6) Once it starts updating the firmware, just wait. Give it time. It can take a few minutes. Don't give up.
7) After it finishes, turn the camera off. Delete the .bin file from the card.
You can read more here, everything from "Preparation" onwards:
http://pentaximaging.com/support/download-details/443
I think there are also some videos on youtube that show it being done and many threads (like
this one) with this same question, so feel free to look around. The first time I did it I was pretty nervous, but its not that difficult
Make sure you download the right firmware for your camera. K-5 is not the same as K-5II.
Oh, and you can't just download staright from the internet to the camera. You need to download, extract on your computer, and then put just the bin file on a formatted card.