Prove that left and right inverses are equal

Let $f:X\to Y$ be any function. Prove that if $h$ is a left inverse of $f$ and $k$ is a right inverse of $f$ then $h=k$

I was thinking of saying that: if $h$ is the left inverse that means $(h\circ f)(x)=id_x$ and if $k$ is the right inverse then $(f\circ k)(x)=id_y$.

Therefore, $(h\circ f)(x)=(f\circ k)(x)$. But how can I prove further that $h=k$? Any ideas?

Hint: The proof begins as follows. $$k = \operatorname{id}_X\circ k = (h\circ f)\circ k = \ldots$$