Draw triangle $KLM$, where as usual the length of the side opposite $K$ is $k$, and so on.
Draw the line segment $MQ$, where $Q$ is the midpoint of the side $KL$ of length $m$. We want to find the length $x$ of the median $MQ$.
Let $\theta=\angle MQK$. Then $\angle MQL=\phi=180^\circ-\theta$.
By the Cosine Law for $\triangle MQK$, we have
$$l^2=x^2+\frac{m^2}{4}-(2x)\left(\frac{m}{2}\right)\cos \theta.$$
By the Cosine Law for $\triangle MQL$, we have
$$k^2=x^2+\frac{m^2}{4}-(2x)\left(\frac{m}{2}\right)\cos \phi.$$
Add, and use the fact that $\cos\phi=-\cos\theta$. We get very nice cancellation, and obtain
$$k^2+l^2=2x^2+\frac{m^2}{2}.$$
Now solve for $x$.