One uses the following trick.
By the projection formula we have $${p_2}_*(\mathcal{O}_{X\times Y_1}) \cong {p_2}_*(p_2^*M_1 \otimes L_1^{-1}) \cong M_1 \otimes {p_2}_*(L_1^{-1})$$ and since $X$ is complete it follows from the Künneth formula that $${p_2}_*\mathcal{O}_{X\times Y_1} \cong \mathcal{O}_{Y_1}$$ which gives the desired isomorphism on $Y_1$ by uniqueness of inverses up to isomorphism in the Picard group.