args = gets.split(" ")
n = args[0].to_i
m = args[1].to_i
#p n
#p m

$candies = gets.split(" ").map!{|x|x.to_i}
#p $candies

def calc_sum(l,r)
	#printf("%d,%d\n",l,r)
	sum = 0
	i = l
	loop do
		sum = sum + $candies[i]
		i=i+1
		if( i > r ) then
			#p 'break'
			break
		end
	end
	return sum
end

count = 0

for r in 0..n-1
	for l in 0..r
		sum = calc_sum(l,r)
		#p sum
		if(sum%m==0)
			count= count+1
		end
	end
end

p count
