N, M = map(int, input().split())
A = list(map(int, input().split()));
B = [];
answer = 0;

for i in range(N):
    nowA = A[i];
    B.append(0);
    for j in range(i+1):
        B[j] += nowA;
        if(B[j]%M==0):
            answer+=1;

print(answer);
