I want to understand more about this proof from Lang's Algebra:
Let $B$ be a subgroup of a free abelian group $A$ with basis $(x_i)_{i=1...n}$. It has already been shown that $B$ has a basis of cardinality $\leq n$.
... We also observe that our proof shows that there exists at least one basis of $B$ whose cardinality is $\leq n$. We shall therefore be finished when we prove the last statement, that any two bases of $B$ have the same cardinality. Let $S$ be one basis, with a finite number of elements $m$. Let $T$ be another basis, and suppose that $T$ has at least $r$ elements. It will suffice to prove that $r \leq m$ (one can then use symmetry).
Let $p$ be a prime number. Then $B/pB$ is a direct sum of cyclic groups of order $p$, with $m$ terms in the sum. Hence its order is $p^m$. Using the basis $T$ instead of $S$, we conclude that $B/pB$ contains an $r$-fold product of cyclic groups of order $p$, whence $p^r \leq p^m$ and $r \leq m$, as was to be shown. (Note that we did not assume a priori that T was finite.)
I've bolded the parts I'm having trouble with. How do I show the first part and what's an $r$-fold product?
Alternative proofs to the problem welcome.
I know that $pB = \{ \sum_{i} p k_i x_i\ | \sum_{i} k_i x_i \in B\}$ and that it forms a normal subgroup, $A$ being abelian.
That $S = \{s_1,\,\dotsc,\, s_m\}$ is a basis of $B$ means that every $b \in B$ can be written in a unique way as $b = \sum\limits_{i=1}^m k_i\cdot s_i$ with all $k_i \in \mathbb{z}$. Thus $B$ is the direct sum of $m$ copies of $\mathbb{Z}$,
$$B = \bigoplus_{i=1}^m \mathbb{Z}\cdot s_i.$$
Then we have
$$pB = \bigoplus_{i=1}^m p\mathbb{Z}\cdot s_i,$$
and that yields
$$B/pB \cong \bigoplus_{i=1}^m (\mathbb{Z}/p\mathbb{Z})\cdot s_i,$$
that $B/pB$ is the direct sum of $m$ cyclic groups of order $p$.
Now $T$ is by assumption also a basis of $B$, so we also have
$$B = \bigoplus_{\tau \in T} \mathbb{Z}\cdot \tau,$$
and
$$B/pB \cong \bigoplus_{\tau \in T} (\mathbb{Z}/p\mathbb{Z})\cdot\tau.$$
If $T$ contains at least $r$ elements, say we have $t_1,\,\dotsc,\,t_r \in T$, then
$$\bigoplus_{j=1}^r (\mathbb{Z}/p\mathbb{Z})\cdot t_j$$
is a subgroup of $B/pB$, and thus $B/pB$ contains the direct sum of $r$ cyclic groups of order $p$. Since for finitely many summands/factors the direct sum and direct product of (abelian) groups are isomorphic, it contains a product of $r$ cyclic groups of order $p$, an $r$-fold product of $\mathbb{Z}/p\mathbb{Z}$.