2. Given $k(k \geqslant 5)$ is a positive integer, the subset $M$ of $\{1,2, \cdots, 2 k-1\}$ satisfies: the sum of any number of elements in $M$ (at least one, or all) is not equal to $2 k$. Then $M$ can have at most $\qquad$ elements.
2.k.

Divide $\{1,2, \cdots, 2 k-1\}$ into $k$ groups:
$$
\{1,2 k-1\},\{2,2 k-2\}, \cdots,\{k-1, k+1\},\{k\} \text {. }
$$

If $|M| \geqslant k+1$, then $M$ must contain two elements in the same group, whose sum is $2 k$, which is a contradiction.
Therefore, $|M| \leqslant k$.
Furthermore, take $M=\{k, k+1, \cdots, 2 k-1\}$, in which the sum of any several elements is either no more than $2 k-1$ or no less than $k+(k+1)=2 k+1$, satisfying the problem's conditions, and $|M|=k$.