import numpy as np

n,m = input().split()

n = int(n)
m = int(m)

a = input().split()
a = [int(i) for i in a]

ans = 0

sumlist = list(np.cumsum(a))
for i in range(n):
    # print(sumlist)
    for j in range(len(sumlist)):
        if sumlist[j] % m == 0:
            ans += 1

    sumlist = list(map(lambda x:x - sumlist[0],sumlist))
    sumlist.pop(0)
print(ans)
