I don't understand the second part of the proof of Corollary 4.8 (Nakayama's Lemma) in Eisenbud's Commutative Algebra.
Let $I$ be an ideal contained in the Jacobson radical of a ring $R$, and let $M$ be a finitely generated $R$-module.
(a) If $IM=M$, then $M=0$.
(b) If $m_1,\dots,m_n\in M$ have images in $M/IM$ that generate it as an $R$-module, the $m_1,\dots,m_n$ generate $M$ as an $R$-module.
Proof of (b): Let $N=M/(\sum_i Rm_i)$. We have $$ N/IN=M/(IM+(\sum_i Rm_i))=M/M=0, $$ so $IN=N$ and $N=0$ by part (a), and the conclusion follows.
I don't understand why the first two equalities of the displayed line above are immediate. Could someone please explain why they hold? Thank you.