a = input().split(" ")
b = input().split(" ")
m = int(a[1])
n = int(a[0])
b = [int(x) for x in b]
c = 0
for i in range(0, n):
	d = 0
	for j in range(i, n):
		d = d + b[j]
		if d % m == 0:
			c += 1
print(c)