Welcome to Justanswer.com, my name is Dustin.
I'm sorry to hear about the issue you are having, I will do my best to help you resolve it.
The max ram Hp recommends for that system is 16 Gigabytes. The ram type is PC4-17000 (DRR4-2133)
Here is a 16 gigabyte kit compatible with your system. http://amzn.to/2bp3pD2
Now, heres the issue with upgrading the video card. The Motherboard in your desktop only has one PCI-e slot.. One PCI-E (GEN 3) x16 socket
If you already have a wireless card or sound card or something else in the slot, then you would need to remove it in order to upgrade the graphics. Next, Higher end video cards have a larger draw / impact on power. Your model only ships with a 180w power supply.
If you want to upgrade the video card, you must upgrade the power supply first. For example, here is a compatible 450 watt power supply http://amzn.to/2bAyfZU
Once you have the upgraded power supply.. My recommendation is this LOW profile 4 gigabyte 2.0 card http://amzn.to/2bp7IhE
You do not have a lot of space in that case, so you cannot run a dual slot card. You cant run a full size graphics card. And also since you dont have a lot of space you need a card that runs colder yet has enough power to make a real difference. The zotac card is set at a very low price point for the 4 gigabyte model, and will work in your case.
So with the ram, power supply and graphics card you should be able to play any game on the market. You may want to refrain from playing on extreme settings if you are after maximum FPS, but you will be able to handle any game as that card is direct x12 and windows 10 compatible.
I strive to provide great service, and greatly appreciate a 5 star rating clicked and submitted when you are satisfied.. I always answer follow up questions.
Senior Technician and Network Switching Systems Operator / Maintainer.