Maximal ideals of $B[y]$ where $B$ is PID. As I know there is a theorem, which says the following: 

The prime ideals of $B[y]$, where $B$ is a PID, are $(0), (f)$, for irreducible $f \in B[y]$, and all maximal ideals. Moreover, each maximal ideal is of the form $m = (p,q)$, where $p$ is an irreducible element in $B$ and $q$ is an irreducible element in $(B/(p))[y]$.

I managed  to prove, that any prime non-principal ideal $m \subset B[y]$ is maximal. This gives the first part of the theorem. Now I want to prove, that $m = (p,q)$. I can show, that $m \cap B \neq (0)$. Thus $m$ contains a non-zero element $a$ from B. Since $B$ is PID and $m$ is prime, $m$ must contain an irreducible element from $B$ (we can take an irreducible factor $p$ of $a$). 
As I understand, now I need to show, that $m$ contains an element $q$ (see the theorem above). Then it follows that $(p,q) \subseteq m$. And after that I have to prove, that $m \subseteq (p,q)$. How do I make these last steps?
Yes, I have seen similar questions with $B = k[x]$ or $\mathbb{Z}$, but I still cannot prove the last part.

Let $p$ be a generator of $m\cap B$, so that $p$ is prime, and let $k=B/p$.  Since $\mathfrak{m}$ is maximal in $B[X]$, $\mathfrak{m}/p$ is maximal in $B[X]/p \cong k[X]$.
Since $k$ is a field, maximal ideals of $k[X]$ are exactly those generated by irreducible polynomials, there is some polynomial $q\in B[X]$ whose image in $k[X]$ is irreducible and generates $\mathfrak{m}/p$.  Then $\mathfrak{m}=(p,q)$.
