As I remember. You can:
(a1 mod x + a2 mod x + a3 mod x + ... + an mod x) mod x
Such an equation will benefit one purpose. if the sum of the numbers exceeds the capacity of the variable used to sum. ex. 32 bit int.
Thus, most likely, the sum of the modules will correspond to the var used for summation. depending on the value of x and the length of the sequence.
Code example
int sum = 0; for (int i=0;i<n;i++) sum += a[i] % x; int mod = sum % x;
Better approach (not very sure)
int sum = 0; for (int i=0;i<n;i++) { sum += a[i] % x; sum %= x; } int mod = sum;
source share