a,b = map(int,input().split())
c = list(map(int,input().split()))
cnt = 0
for i in range(a):
    j = i + 1
    while j < a+1:
        c[i:j]
        if sum(c[i:j])%b == 0:
            cnt += 1
        j += 1
print(cnt)