n, m = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for l in range(n):
    s = 0
    r = l
    for r in range(r, n):
        s += a[r]
        if s % m == 0:
            count += 1
print(count)
