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

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

AmodM=[]
answer=0

for i in range(N):
  AmodM.append(A[i]%M)

for i in range(N):
  modlist=A[i]
  if modlist%M==0:
    answer+=1
  for j in range(i+1,N):
    modlist+=A[j]
    if modlist%M==0:
      answer+=1
print(answer)  