parseInt(x) = parse(Int,x)

function main()
	n,m = map(parseInt, split(readline()))
	a = map(parseInt, split(readline()))
	b = Array{Int}(n)
	b[1] = a[1]%m
	for i in 2:n
		b[i] = (b[i-1]+a[i])%m
	end
	k = 0
	for i in 1:n
		if b[i] == 0
			k += 1
		end
		for j in 1:i-1
			if b[i]-b[j] == 0
				k += 1
			end
		end
	end
	print(k)
end
main()