Example 6 Let $a_{1}, a_{2}, \cdots, a_{n}$ be an increasing sequence of positive integers. For a positive integer $m$, define
$$
b_{m}=\min \left\{n \mid a_{n} \geqslant m\right\}(m=1,2, \cdots),
$$

i.e., $b_{m}$ is the smallest index $n$ such that $a_{n} \geqslant m$. Given that $a_{20}=2019$, find the maximum value of $S=\sum_{i=1}^{20} a_{i}+\sum_{i=1}^{2019} b_{i}$.
(Adapted from the 1985 United States of America Mathematical Olympiad)
If $a_{1}=a_{2}=\cdots=a_{20}=2019$, then $b_{1}=b_{2}=\cdots=b_{2019}=1$.
Thus, $S=2019 \times 20+2019=42399$.
Now, assume $a_{1}, a_{2}, \cdots, a_{20}$ are not all equal. In this case, there exists an $i(1 \leqslant i \leqslant 19)$ such that $k=a_{i}<a_{i+1}=2019$.
Perform a perturbation transformation: $a_{i}^{\prime}=a_{i+1}, a_{j}^{\prime}=a_{j}(i \neq j)$.
Then, $b_{l}^{\prime}=b_{l}-1(l \geqslant k+1), b_{m}^{\prime}=b_{m}(m \leqslant k)$.
Thus, $S^{\prime}=\sum_{i=1}^{20} a_{i}^{\prime}+\sum_{i=1}^{2019} b_{i}^{\prime}$ $=\sum_{i=1}^{20} a_{i}+\sum_{i=1}^{2019} b_{i}$.
Therefore, the value of $S$ remains unchanged under perturbation.
In a finite number of perturbations, $a_{1}, a_{2}, \cdots, a_{20}$ can be transformed to $a_{1}=a_{2}=\cdots=a_{20}=2019$.
Hence, $S$ is always 42399, meaning the maximum value of $S$ is 42399.