I've been trying to solve this for a little while. I know that $H\cap K = \{1\}$ because of their orders and from the isomorphism theorems I know that $ HK /K \simeq H$.
I've been trying to see if there an application of the isomorphism theorems that leads somewhere, and trying to work with Lagrange but again, I don't see how any of it leads somewhere.
Any help would be greatly appreciated.
Hint: look at $K$ as normal subgroup of $HK$. Its index$[HK:K]=|H|$, as you noted. Hence $K$ is a normal subgroup, such that the gcd of its order and index are relatively prime. This implies that $K$ is a characteristic subgroup (invariant under all automorphisms of $HK$, written $K$ char $HK$). Now use the fact that in general for groups $X, Y, Z$, $X$ char $Y \unlhd Z$, implies $X \unlhd Z$.