  We analyze the topological $\mathbb{Z}_2$ invariant, which characterizes time
reversal invariant topological insulators, in the framework of index theory and
K-theory. The topological $\mathbb{Z}_2$ invariant counts the parity of
generalized Majorana zero modes, which can be interpreted as an analytical
index. As we show, it fits perfectly into a mod 2 index theorem, and the
topological index provides an efficient way to compute the topological
$\mathbb{Z}_2$ invariant. Finally, we give a new version of the bulk-boundary
correspondence which yields an alternative explanation of the index theorem and
the topological $\mathbb{Z}_2$ invariant. Here the boundary is not the
geometric boundary of a probe, but an effective boundary in the momentum space.
