io = STDIN
n,m=io.gets.split.map(&:to_i)
ar=io.gets.split.map(&:to_i)
sum=Array.new(n,0)
sum[0]=ar[0]
i=1
while i<n
  sum[i]+=ar[i]+sum[i-1]
  i+=1
end
tot=0
ar.unshift(0)
sum.unshift(0)
(0..n).each do |i|
  ((i+1)..n).each do |j|
    tot+=1 if (sum[j]-sum[i])%m==0
  end
end
p tot
