n, r, t = gets.split.map &:to_i
pace = n.times.map { gets.to_i }
ans = 0
cnt = [0] * r
pos = [0] * n
t.times do |time|
	n.times { |i| pos[i] = (pos[i] + pace[i]) % r }

	if time != 0
		num = [0] * r
		pos.each { |i| num[i] += 1 }
		r.times do |i|
			if cnt[i] < num[i]
				ans += num[i] - cnt[i]
				cnt[i] = num[i]
			end
		end
	else
		ans += n
	end
end
puts ans

