Given such a subspace, we can choose a basis consisting of 1. $r'$ vectors in $W_1 \cap W_2$ 2. $n_1-r'$ additional vectors in $W_1$ that remain linearly independent in $W_1 / (W_1 \cap W_2)$ 3. $n_2-r'$ additional vectors in $W_2$ that remain linearly independent in $W_2 / (W_2 \cap W_2)$ 4. $k-n_1-n_2+r'$ additional vectors in $V$ that, modulo the $n_1+n_2-r'$-dimensional subspace spanned by the previous vectors, do not intersect the $m-n_1$-dimensional image of $W_1$ or the $m-n_2$-dimensional image of $W_2$. It's easy to count the number of possible lists of vectors for the first three, and the number of choices in a fixed subspace. I think it's $$\left[\matrix{ r \\ r'} \right]_p \left[\matrix{ m_1-r \\ n_1-r'} \right]_p \left[\matrix{ m_2-r \\ n_2-r'} \right]_p p^{(r-r') (n_1+n_2-2r')} $$ (A simpler argument along these lines gives a proof of the identity Richard Stanly mentions in the comments) So it remains to see how much the fourth kind of vectors increases the count. Each successive vector of the fourth type we choose must avoid three subspaces - the image of $W_1$, the image of $W_2$, and the span of the previous vectors. We can count these using inclusion-exclusion because we know the intersection of each type of subspace with the others, as the new vectors we are adding at the fourth step, by definition, do not increase any of these intersections. So the next term is: $$\prod_{i=n_1+n_2-r'}^{k-1} ( p^n - p^i - p^{m_1} - p^{m_2} + p^{n_1} + p^{n_2} + p^{r} - p^{r'})$$ The denominator is given by a simpler formula - the number of choices for the remainder of the basis is just $$(k-n_1-n_2+r'!)_p p^{ (k-n_1-n_2+r') (n_1+n_2-r')}$$ So putting it all together, it's $$\frac{ \left[\matrix{ r \\ r'} \right]_p \left[\matrix{ m_1-r \\ n_1-r'} \right]_p \left[\matrix{ m_2-r \\ n_2-r'} \right]_p\prod_{i=n_1+n_2-r'}^{k-1} ( p^n - p^i - p^{m_1} - p^{m_2} + p^{n_1} + p^{n_2} + p^{r} - p^{r'}) }{(k-n_1-n_2+r'!)_p p^{ (k-n_1-n_2+r') (n_1+n_2-r')-(r-r') (n_1+n_2-2r')} }$$ $$$$ Note that as $p$ goes to $1$ this becomes a perfectly ordinary product of binomial coefficients, because the weirdness of the six-term sum of exponentials becomes a simple six-term sum of constants.