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

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

print(ans)