#おかしの問題
n,m = map(int,input().split())
number = list(int(input().split()))
a = []
#ここから書きかえ
for i in range(n):
    for j in range(n-i):
            b=[]
            for k range(i+1):
                b.append(number[j+k-1])
            if sum(b)%m == 0:
                a.append(1)
            else:
                pass
print(len(a))