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

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

print(ans)
