# coding: utf-8

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

acc = [0]

for i in range(n):
    acc.append(acc[i]+a[i])    

count = 0
for i in range(n+1):
    for j in range(i):
        if (acc[i]- acc[j]) %m == 0:
            count += 1

print(count)