Candies drawn from both bowls
Let's fix a particular candy $C$ that is in both bowls. You draw $m_1$ out of the $N_1$ candies in the first bowl, so your chance of drawing $C$ is $\frac{m_1}{N_1}$. Independently, your chance of drawing it from the second bowl is $\frac{m_2}{N_2}$. So your probability of getting a pair of $C$ is $\frac{m_1m_2}{N_1N_2}$. Now you just need to sum this over all the possible values of $C$ to get the expected number of pairs is $p\frac{m_1m_2}{N_1N_2}$