\(\dfrac{x}{a}=\dfrac{m-\dfrac{x}{2}}{m}\)
\(\Rightarrow xm=a\left(m-\dfrac{x}{2}\right)\)
\(\Rightarrow xm=am-\dfrac{ax}{2}\)
\(\Rightarrow2xm=2am-ax\)
\(\Rightarrow2xm+ax=2am\)
\(\Rightarrow x\left(2m+a\right)=2am\)
\(\Rightarrow x=\dfrac{2am}{a+2m}\)