Answer
a) $0.85\;\rm m$
b) $2.55\;\rm m$
Work Step by Step
$$\color{blue}{\bf [a]}$$
The energy is conserved, so
$$K_i+U_{ig}+U_{ie}=K_f+U_{fg}+U_{fe}$$
at the highest point the bead stops before falling back, so $K_f=0$
$$K_i+U_{ig}+U_{ie}=0+U_{fg}+U_{fe}$$
At the bottom, $y=0$, so $U_{ig}=0$, and $V_i=0$, so $U_{ie}=0$
$$K_i+0+0= U_{fg}+U_{fe}$$
$$ \frac{1}{2} mv_0^2= mgy_1+qV_f$$
Recall that, $V_f=Es$ whereas $s$ here is as same as $y_1$.
$$ \frac{1}{2} mv_0^2= mgy_1+q Ey_1$$
Recall that the electric field inside a two-plate capacitor is constant and uniform and is given by $E=\Delta V_C/d$
$$ \frac{1}{2} mv_0^2= mgy_1+\dfrac{q y_1( V_{\rm top}-V_{\rm bottom})}{d}$$
$$ \frac{1}{2} mv_0^2= mgy_1+\dfrac{q y_1( V_{\rm top}-0)}{d}$$
$$ \frac{1}{2} mv_0^2= y_1\left[ mg +\dfrac{q V_{\rm top} }{d}\right]$$
$$ y_1=\frac{ mv_0^2}{2\left[ mg +\dfrac{q V_{\rm top} }{d}\right]} $$
Plug the known;
$$ y_1=\frac{ (1\times 10^{-3})(5)^2}{2\left[ (1\times 10^{-3})(9.8)+\dfrac{(4.9\times 10^{-9})(3\times 10^6)}{3}\right]} $$
$$y_1=\color{red}{\bf 0.85}\;\rm m$$
$$\color{blue}{\bf [b]}$$
By the same approach, but changing the sign of the top plate charge.
$$ y_1=\frac{ mv_0^2}{2\left[ mg +\dfrac{q V_{\rm top} }{d}\right]} $$
Plug the known;
$$ y_1=\frac{ (1\times 10^{-3})(5)^2}{2\left[ (1\times 10^{-3})(9.8)+\dfrac{(4.9\times 10^{-9})(-3\times 10^6)}{3}\right]} $$
$$y_1=\color{red}{\bf 2.55}\;\rm m$$
In both cases, the bead will not hit the ceiling.