Solution (source code)

= Solution

Each of the $M$ vortices contributes one bulk <Majorana zero mode>. A finite fermionic system must have an even total number of Majorana zero modes. The boundary <Chiral Majorana edge mode> has no zero momentum in the antiperiodic sector but has one $k=0$ Majorana mode in the periodic sector. Therefore
$$
c(x+L)=
\begin{cases}
-c(x),&M\text{ even},\\
+c(x),&M\text{ odd},
\end{cases}
$$
or compactly $c(x+L)=(-1)^{M+1}c(x)$. This <boundary condition of a chiral Majorana edge mode> supplies the extra boundary zero mode exactly when the vortex count is odd.