# encoding: utf-8
N, M = list(map(int, input().split()))

# TLE
Amod = [A for A in map(lambda x: int(x) % M , input().split())]
ans = 0
for l in range(len(Amod)):
    acm = 0
    for r in range(l, len(Amod)):
        acm = (acm + Amod[r]) % M
        if acm == 0: ans += 1

print(ans)