n, r, t = gets.split.map(&:to_i)
pase = (1..n).map { gets.to_i }
pos = Array.new(n, 0)
stock = Array.new(r, 0)
t.times do |k|
    empty = Array.new(r, 0)
    (0..n-1).each do |i|
        x = (pos[i] + pase[i]) % r
        empty[x] += 1 if k > 0
        stock[x] -= 1 if stock[x] > 0
        pos[i] = x
    end
    (0..r-1).each do |j|
        stock[j] += empty[j]
    end
end
p stock.inject(:+) + n
