# encoding: utf-8
N, M = list(map(int, input().split()))
Amod = [int(A) % M for A in input().split()]

ans = 0
for l in range(N):
    acm = 0
    for r in range(l, N):
        acm = (acm + Amod[r]) % M
        if acm == 0: ans += 1

print(ans)