# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# なんこか入力
n,m = map(int, input().split())

# 空白区切りの数列をリストに代入
a = [int(i) for i in input().split()]
b = [0]*(n+1)
bb=0

for i in range(0,n) :
    b[i+1] = bb = ( bb+a[i] ) % m
    
answer = 0
for r in range(1,n+1) :
    for l in range(0,r) :
        if (b[r] - b[l] ) == 0:
            answer += 1

print(answer)

