For $0<\nu<n$ there are no compact semi-Riemannian hypersurfaces in $\mathbb{R}_{\nu}^{n}$

I'm reading a proof of the following proposition:

For $0<\nu<n$ there are no compact semi-Riemannian hypersurfaces in $\mathbb{R}_{\nu}^{n}.$

The proof is as follows:

Suppose that there is $M\subset\mathbb{R}_{\nu}^{n}$ compact semi-Riemannian hypersurface. Consider the canonical basis for $\mathbb{R}_{\nu}^{n},$ $\{e_{i}\}_{i=1}^{n},$ such that $\{e_{i}\}_{i=1}^{\nu}$ are timelike and the rest $\{e_{i}\}_{i=\nu+1}^{n}$ are spacelike. Then each $x\in M$ can be expressed as $x=\sum x_{i}e_{i}.$

Consider the functions $f_{1},f_{2}:M\rightarrow\mathbb{R}$ given by $f_{1}(x)=x_{1}$ and $f_{2}(x)=x_{n}.$ Such functions have maximum and minimum because of continuity of these and compactness of $M.$ Let $p$ and $q$ critic points of $f_{1}$ and $f_{2}$ respectly. By construction $T_{p}(M)$ has index $\nu-1$ but $T_{q}(M)$ has index $\nu.$ The proof is done.

I have a doubt: why $T_{p}(M)$ and $T_{q}(M)$ have such index and why this finish the proof? I can't see how the contradiction is get and how it works.

Any kind of help is thanked in advanced.

The tangent space of $M$ at $p$ within $\Bbb R^n_\nu$ is orthogonal to $e_1$ as $p\in M$ has the smallest first coordinate. Hence the index of $T_pM$ is $\nu-1$.