#!/usr/bin/env python3

import numpy as np

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

a_sum = np.cumsum(a)

ans = 0
diff = 0
for i in range(len(a)):
    ans += np.sum(((a_sum[i:]-diff) % m) == 0)
    diff += a[i]

print(ans)
