6. Given $a_{1}, a_{2}, \cdots, a_{10}$ are ten different positive integers, satisfying
$$
\left|a_{i+1}-a_{i}\right|=2 \text { or } 3 \text {, }
$$

where, $i=1,2, \cdots, 10$, with the convention $a_{11}=a_{1}$.
If $a_{1}, a_{2}, \cdots, a_{10}$ have the maximum number $M$ and the minimum number $m$, then the maximum value of $M-m$ is ( ).
(A) 13
(B) 14
(C) 15
(D) 16
6. B.

Assuming without loss of generality that $m=a_{1}=1$, and the maximum value $M=a_{j}$. Thus, $a_{j}-a_{1}$
$$
\begin{array}{l}
=\left(a_{j}-a_{j-1}\right)+\left(a_{j-1}-a_{j-2}\right)+\cdots+\left(a_{2}-a_{1}\right) \\
\leqslant\left|a_{j}-a_{j-1}\right|+\left|a_{j-1}-a_{j-2}\right|+\cdots+\left|a_{2}-a_{1}\right| \\
\leqslant 3(j-1) .
\end{array}
$$
$$
\begin{array}{l}
\text { Also, } a_{j}-a_{1} \\
=\left(a_{j}-a_{j+1}\right)+\left(a_{j+1}-a_{j+2}\right)+\cdots+\left(a_{10}-a_{1}\right) \\
\leqslant\left|a_{j}-a_{j+1}\right|+\left|a_{j+1}-a_{j+2}\right|+\cdots+\left|a_{10}-a_{1}\right| \\
\leqslant 3(11-j),
\end{array}
$$

Then $2(M-m)=2\left(a_{j}-a_{1}\right)$
$$
\leqslant 3(j-1)+3(11-j)=30 \text {. }
$$

Thus, $M-m \leqslant 15$.
If $M-m=15$, then the equalities in (1) and (2) must hold.
Therefore, $a_{2}=a_{10}$, which is a contradiction.
Hence, $M-m \leqslant 14$.
Taking $a_{1}=2, a_{2}=4, a_{3}=7, a_{4}=10, a_{5}=13$, $a_{6}=16, a_{10}=5, a_{9}=8, a_{8}=11, a_{7}=14$ satisfies the conditions.
Therefore, the maximum value of $M-m$ is 14.