I would suggest labelling the two sides as "x" and "y", so their speeds are "dx/dt" and "dy/dt", respectively. The distance D is the vertical side's length. Then note that this is a right triangle, so x2 + D2 = y2 (assuming "y" is the hypotenuse). Differentiate, etc.