# Counting subsets with intersecting property

I'd like to count the number of pairs of subsets $$A,B$$ of $$\{1, 2, \dots, n\}$$ such that $$|A|=|B|=k$$ and if $$A=\{a_1, a_2, \dots, a_k\}$$ with $$a_1 < a_2 < \cdots < a_k$$ and $$B=\{b_1, b_2, \dots, b_k\}$$ with $$b_1 < b_2 < \cdots < b_k$$, then $$a_i = b_i$$ for $$i=1, 2, \dots, m$$. Ideally, I'd like to find a closed form expression (without sums) involving $$n$$, $$k$$, and $$m$$.

Does anyone know any references for tackling these sort of counting problems? Thanks!

The answer with a summation is $$\sum_{i=m}^{n-k+m} \binom{i-1}{m-1}\binom{n-i}{k-m}^2.$$ The interpretation is $$i=a_m=b_m$$. Choose $$\{a_1,\dots,a_{m-1}\}$$ in $$\binom{i-1}{m-1}$$ ways, then choose $$\{a_{m+1},\dots,a_k\}$$ and $$\{b_{m+1},\dots,b_k\}$$ in $$\binom{n-i}{k-m}^2$$ ways.