#include <iostream>

using namespace std;

int T, D, L;

int main(void)
{
	while(1){
		cin >> T >> D >> L;
		if(T == 0 && D == 0 && L == 0) break;
		
		int rem = 0, h, ans = 0;
		for(int i = 1; i <= T; i++){
			cin >> h;
			if(i == T) continue;
			if(h >= L) rem = D;
			if(rem > 0) ans++;
			rem--;
		}
		cout << ans << endl;
	}
	return 0;
}
