n,m = gets.split.map{|x|x.to_i}
a = gets.split.map{|x|x.to_i}

dp = Array.new(n).map{[]}
count = 0

(0..n-1).each do |l|
    (l..n-1).each do |r|
        if l==r
            dp[l][r] = a[r] % m
        else
            dp[l][r] = (dp[l][r-1] + a[r] % m) % m
        end
        
        if dp[l][r] == 0
            count += 1
        end
    end
end
puts count
