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

for i in range(N):
    index = 0
    while index <=N-i-1:
        Sum = A[i]
        if (Sum)%M==0:
            ans += 1
        Sum += A[i+index]
        index += 1 
print(ans)