import numpy as np
import math

N, M = map(int, input().split())

A = list(map(int, input().split()))

# 1 <= N <= 10^5
# 2 <= M <= 10^9
# 1 <= A <= 10^9

dp = np.zeros(N+1, dtype=int)

dp[N] = 0

total = 0
mods = list()
mods.append(0)

for i in reversed(range(N)):
    for j in range(len(mods)):
        newm = (A[i] + mods[j]) % M
        if newm == 0:
            total += 1
        mods[j] = newm
    mods.append(0)
    # print(mods)
    
print(total)
