N, M = map(int, input().split())		# 5 7
A = list( map(int, input().split()) )	# 1 2 3 4 5 ...


X=[]

for i in range(N):
	a=0
	Y=[]
	for j in range(i,N):
		r=A[j]
		a+=r
		X.append(a)
#	X.append(Y)

#print(X)

ans=0
for i in X:
	if i%M==0: ans+=1

print(ans)
