Easy - do it in 3 steps:
1. Download the ISO of the version of Windows for this PC,
2. Perform a clean installation,
3. Activate it using the product key on the COA sticker on the PC.
The ISO download link, and instructions for performing a clean install are all detailed here: Clean Reinstall - Factory OEM Windows 7
Read the HP specific section towards the bottom of the tutorial for extra information.