N,M=map(int,input().split())
a=list(map(int,input().split()))
dp=[[0 for i in range(N+1)] for j in range(N+1)]
count=0
for i in range(N):
    dp[i+1][i+1]=a[i]
    if a[i]%M==0:
        count+=1
    if N==1:
        break
    else:
        for j in range(i+2,N+1):
            dp[i+1][j]=dp[i+1][j-1]+a[j-1]
            if dp[i+1][j]%M==0:
                count+=1
print(count)