I'm starting to study algebraic K-theory by myself and I need a hint how to prove
$R$ is a semilocal ring with maximal ideals $\mathfrak m_1,\ldots, \mathfrak m_n$, $P$ is a projective module and there exists $k$ such that $$P_{\mathfrak m_i}\cong (R_{\mathfrak m_i})^k$$ for all $i=1,\dots,n$, then $P$ is a free module.
If I prove that $P$ is a stably free module, we're done, because $R$ is a semilocal ring.
Since $P$ is projective, the $P_{\mathfrak m_i}$ are free for every $i$.
I need help how to continue, I'm a really beginner in this subject.
Thanks in advance.