N, M = map(int, input().split())
A = list(map(int, input().split()))

def total(a, b):
	ans = 0
	for i in range(a,b):
		ans += A[i]

	return ans

count = 0
for i in range(N):
	for j in range(i + 1, N + 1):
		if not total(i, j) % M:
			count += 1

print(count)