Quite abstract and rather unsuitable for juniors in my opinion.
Note that $a_2 + a_{2022} < a_{i} + a_{2022}$ for $i=3,\ldots,2021$ and $a_2 + a_{2022} < a_j + a_{2023}$ for $j=2,\ldots,2022$, so $a_{2} + a_{2022}$ is not bigger than $2019 + 2021 = 4040$ of the sums, implying $M \leq \frac{2023 \cdot 2022}{2} - 4040 - 1 = 2041212$. Equality holds e.g. for $2, 2^2, \ldots, 2^{2022}, 2^{2022} + a$ where $a\in (0,2)$ is an arbitrary irrational number (the pairwise sums are distinct: if the largest number is involved, this follows by irrationality of $a$; if not, then this follows by modulo $2^{A+1}$, where $2^A$ is the smallest appearing power).
The lower bound is $4040$ and obtained analogously, by mirroring everything above (multiply all terms of the sequence by $(-1)$).