The basic idea is that if you sum $a_n$ or $a_{f(n)}$ up to some $N\gg X$, you get more or less the same terms except for about $2X$ terms near $a_N$, which are all very small.
We have $$\sum_{n=1}^N a_n - \sum_{n=1}^N a_{f(n)} =\sum_{j\ge N-X: f(j)>N} a_j - \sum_{N+X\ge j>N: f(j)< N} a_j $$ As $\sum_{n=0}^\infty a_n$ converges, $a_n\to 0$, so the $2X$ terms on the right hand side also tend to $0$ as $N\to\infty$. It follows that $\sum_{n=1}^\infty a_{f(n)}$ is convergent.