Stuck on this question, struggling to see where to start.
Each element of HK is of the form hk, where $\displaystyle h\in H,\;k\in K$. But there may be more than one way of representing the same element as such a product.
So suppose that $\displaystyle h_1k_1 = h_2k_2$. Then $\displaystyle h_2^{-1}h_1 = k_2k_1^{-1} = p$ say, where $\displaystyle p\in H\cap K$ (because $\displaystyle p = h_2^{-1}h_1\in H$ and also $\displaystyle p = k_2k_1^{-1}\in K$).
Use that to count the number of ways that each element of HK can be expressed as a product of the form hk.