Answer
$\theta=tan^{-1}(\frac{a}{g})$
Work Step by Step
We can determine the required angle as follows:
$\Sigma F_x=ma_x$
$\implies A_x=-ma$
Similarly, the equation of motion in y-direction is given as
$\Sigma F_y=ma_y$
$\implies A_y-W=0$
$\implies A_y=mg$
Now, we apply the sum of moment about the center of gravity
$\Sigma M_G=0$
$\implies -A_x(Lcos\theta)-A_y (Lsin\theta)=0$
$\implies -(-ma)Lcos\theta-mgLsin\theta=0$
$\implies acos\theta=gsin\theta$
This simplifies to:
$tan\theta=\frac{a}{g}$
$\implies \theta=tan^{-1}(\frac{a}{g})$