As part of a much larger proof, I have encountered the following situation. I have that $B$ is a PID and $P$ is a prime ideal of the polynomial ring $B[y]$. I know that the intersection of $P$ and $B$ is non-empty, and therefore $P\cap B$ must be a maximal ideal of $B$ (because it is a prime ideal and every non-zero prime ideal of a PID maximal).
Now, I want to prove that $P$ is also a maximal element of $B[y]$. This is where I get stuck. I have tried several things like proving that $B[y]/P$ is a field or using the correspondence between the ideals of $B[y]$ that contain $P$ and the ideals of $B[y]/P$, but none of them got me anywhere. Could someone help me with this?
Edit I forgot to mention that we also know that $P$ is not a principal ideal.