I assume that risk it measured here in volatility.
Then a portfolio with 100*$w$ percent invested in A and 100*$(1-w)$ percent invested in B has the annual variance
v = w^2 0.25^2 + 2* 0.5 w(1-w) 0.25*0.5 + (1-w)^20.5^2.
Searching for the portfolio with the samllest variance is equivalent to searching for the smallest volatility.
To get the minimum we take the derivative of $v$ w.r.t. $w$
dv/dw = 2 w 0.25^2 + (1-2w) 0.25*0.5 + (2w-2)0.5^2.
Searching the root of this we get that $w^* = 1$.
Thus we should invest all our wealth in stock A and the minimal risk is 25%.
If the volatolity of B were smaller it could reduce risk to invest in B. However as the volatility of B is that high and the correlation is rather large diversification does not work here.
For example the 50/50 portfolio has a volatility of approx 74%. The 80/20 has 59% and 90/10 has 56.7%.