Characterizing units in polynomial rings

I am trying to prove a result, for which I have got one part, but I am not able to get the converse part.

Theorem. Let $R$ be a commutative ring with $1$. Then $f(X)=a_{0}+a_{1}X+a_{2}X^{2} + \cdots + a_{n}X^{n}$ is a unit in $R[X]$ if and only if $a_{0}$ is a unit in $R$ and $a_{1},a_{2},\dots,a_{n}$ are all nilpotent in $R$.

Proof. Suppose $f(X)=a_{0}+a_{1}X+\cdots +a_{n}X^{n}$ is such that $a_{0}$ is a unit in $R$ and $a_{1},a_{2}, \dots,a_{r}$ are all nilpotent in $R$. Since $R$ is commutative, we get that $a_{1}X,a_{2}X^{2},\cdots,a_{n}X^{n}$ are all nilpotent and hence also their sum is nilpotent. Let $z = \sum a_{i}X^{i}$ then $a_{0}^{-1}z$ is nilpotent and so $1+a_{0}^{-1}z$ is a unit. Thus $f(X)=a_{0}+z=a_{0} \cdot (1+a_{0}^{-1}z)$ is a unit since product of two units in $R[X]$ is a unit.

I have not been able to get the converse part and would like to see the proof for the converse part.

Let $$f=\sum_{k=0}^n a_kX^k$$ and $$g= \sum_{k=0}^m b_kX^k$$. If $$f g=1$$, then clearly $$a_0,b_0$$ are units and:

$$a_nb_m=0 \tag1$$
$$a_{n-1}b_m+a_nb_{m-1}=0$$

(on multiplying both sides by $$a_n$$)

$$\Rightarrow (a_n)^2b_{m-1}=0 \tag2$$
$$a_{n-2}b_m+a_{n-1}b_{m-1}+a_nb_{m-2}=0$$
(on multiplying both sides by $$(a_n)^2$$)
$$\Rightarrow (a_n)^3b_{m-2}=0 \tag3$$
$$…..$$
$$…..+a_{n-2}b_2+a_{n-1}b_1+a_nb_0=0$$
(on multiplying both sides by $$(a_n)^m$$)
$$\Rightarrow (a_n)^{m+1}b_{0}=0 \tag{m+1}$$

Since $$b_0$$ is an unit, it follows that $$(a_n)^{m+1}=0$$.

Hence, we proved that $$a_n$$ is nilpotent, but this is enough. Indeed, since $$f$$ is invertible, $$a_nx^n$$ being nilpotent implies that $$f-a_nX^n$$ is unit and we can repeat (or more rigorously, perform induction on $$\deg(f)$$).