n, m = [int(a) for a in input().split()]

arr = [int(a) for a in input().split()]

res = 0
for i in range(n):
    j = i
    while j < n:
        if sum(arr[i: j+1]) % m == 0:
            res += 1
        j += 1

print(res)