while true
    t, d, l = gets.chomp.split.map(&:to_i)
    break if [t, d, l] == [0, 0, 0]
    arr = []
    t.times{arr << gets.to_i}
    countdown, sum = 0, 0
    arr[0...-1].each{|x|
        countdown = (x >= l) ? d : countdown - 1
        sum += 1 if countdown > 0
    }
    puts sum
end

