N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(1,len(A)+1):
    for j in range(len(A)):
        print([i,j])
        ij_sum = sum(A[j:i])
        print(ij_sum)
        if ij_sum != 0:
            if ij_sum % M == 0:
                ans += 1
print(ans)