#include <bits/stdc++.h>
using namespace std;

int main(void){
	int t, d, l;
	while(cin >> t >> d >> l, t+d+l){
		int x;
		int ans = 0;
		int last = 0;
		for (int i = 0; i < t; ++i)
		{
			cin >> x;
			if(i == t-1) continue;
			if(x>=l){
				last = d;
				
			}
			if(last > 0){
				ans++;
				last--;
			}
		}
		cout << ans << endl;
	}
	return 0;
}
