N, M = map(int, input().split())
A = list(map(int, input().split()))

cands = A
for length in range(2, N+1):
    for i in range(N - length + 1):
        cands.append(sum(A[i : i+length]))
cands

counter = 0

for c in cands:
    if c % M == 0:
        counter += 1

print(counter)
