The underlying idea is

Dirichlet's Box Principle, also known as

The Pigeonhole Principle.

Let $\displaystyle {a_1, a_2, ..., a_m}$ be a set of $\displaystyle m $ positive integers.

Denote $\displaystyle S_1=a_1, S_2=a_1+a_2, ..., S_m=a_1+a_2+\cdots+a_m$. Suppose that none of these sums is divisible by $\displaystyle m $.

The sums give at most $\displaystyle m-1 $ distinct remainders when divided by $\displaystyle m $, namely, $\displaystyle 1, 2, ..., m-1$. But since there are $\displaystyle m $ sums, at least two of them have the same remainder when divided by $\displaystyle m $, say $\displaystyle S_i $ and $\displaystyle S_j $, where $\displaystyle j>i $. Now $\displaystyle S_j-S_i $ is divisible by $\displaystyle m $ and also $\displaystyle S_j-S_i=a_{i+1}+\cdots+a_j$.