The max cpu is the amd A10-5800B (not K). Because this is very hard to find, I recommend AMD a10 5700. As for gpu, any low-profile GPU can run on it (for example a LP RX550 or an Nvidia 1650)
Important: Before you upgrade to a processor not listed above I would contact HP Support to make sure the BIOS version you have installed will support the new processor.