First break the $V$ into two components
The drift $D$ can be written as
$$(u-v\sin x)t=D$$
to find minimum $D$, we differentiate and then equate to $0$
$$\frac{\text{d}D}{\text{d}t}=0 \\ ut-v\sin(x)t=D$$
Differentiating both sides,
$$\left(t\frac{\text{d}u}{\text{d}t}+u\frac{\text{d}t}{\text{d}t}\right)-\left(\frac{\text{d}(v\sin x)}{\text{d}t}+v\sin x\frac{\text{d}t}{\text{d}t}\right)=0 \\ \left(t\frac{\text{d}u}{\text{d}t}+u\frac{\text{d}t}{\text{d}t}\right)-\left(v\frac{\text{d}(\sin x)}{\text{d}t}+\sin(x)\frac{\text{d}v}{\text{d}t}+v\sin x\frac{\text{d}t}{\text{d}t}\right)=0$$
We know,
$$\frac{\text{d}v}{\text{d}t}=0$$
and
$$\frac{\text{d}u}{\text{d}t}=0$$
since acceleration is $0$. So we can write the equation as
$$(0+u)-\left(v\frac{\text{d}(\sin x)}{\text{d}t}+0+v\sin x\right)=0 \\ u-(-v\cos x+v\sin x)=0 \\ u+v\cos x-v\sin x=0 \\ v=\frac{u}{\sin x-\cos x}$$
If we have the velocity of the boat and the velocity of the river, then we can find the angle for which drift is minimum for that particular velocity of boat using the above relation.