import numpy as np

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

array = np.array([0]*n)

count = 0
for k, i in enumerate(lst):
    array[:k+1] = (array[:k+1] + i) % m
    count += sum(array[:k+1] == 0)
print(count)