s = raw_input().split(' ')
n, m = int(s[0]), int(s[1])
nums = []
s = raw_input().split(' ')
for i in range(n):
    nums.append(int(s[i]))
if n == 0:
    print('0')
    exit()
total = [0 for _ in range(n+1)]
total[1] = nums[0]
for i in range(1, n+1):
    total[i] = total[i-1] + nums[i-1]
cnt = 0
for i in range(0, n):
    for j in range(i+1, n+1):
        if (total[j]-total[i]) % m == 0:
            cnt += 1
print cnt