As (in my opinion) Windows 10 is preferable to Win 8.1 is it not worth considering changing from 8.1 to 10 as the offer from Microsoft to upgrade/change for free is valid until July of this year.
That's what I'd do without question, but time is running out as they say.
I'm not sure about HP laptops but I've always been able to format the hard drives of all Netbooks and Laptops I've encountered, even if it means taking out the disk and formatting it externally with another machine.
My disclaimer is that I'll admit I'm not familiar with Hewlett Packard machines.
If you can do that - losing the recovery partition - all you need to legally install Win 8.1 on the newly formatted drive is the activation number that came with your laptop.
The snag is you will need a physical copy of the same version of Win 8.1 currently installed on your machine. Could you borrow a disk from a friend perhaps?