#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>

using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<int>;


bool solve()
{
	int T, D, L;
	cin >> T >> D >> L;

	if (T == 0)return false;

	vec Wet(T, 0);

	for (int i = 0; i < T; ++i)
	{
		int x; cin >> x;

		if (x < L) { continue; }

		Wet[i] += 1;
		if (i + D < T)
		{
			Wet[i + D] -= 1;
		}
	}

	int ans = Wet[0] != 0;

	for (int i = 1; i < T-1; ++i)
	{
		Wet[i] += Wet[i - 1];
		ans += Wet[i] != 0;
	}
	
	cout << ans << endl;

	return true;
}


int main()
{
	while(solve());

	return 0;
}
