N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0
nums = []

for a in A:
    for i in range(len(nums)):
        nums[i] += a
        if not nums[i] % M:
            ans += 1
    if not a % M:
        ans += 1
    nums.append(a)

print(ans)