#include "bits//stdc++.h"
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
int wet[100001];
int main() {
	int T, D, L;
	while (cin >> T >> D >> L, T) {
		memset(wet, 0, sizeof(wet));
		for (int i = 1; i <= T; i++) {
			int x;
			cin >> x;
			if (x >= L) {
				wet[i]++;
				if (i + D <= T) wet[i + D]--;
			}
		}
		int ans = 0;
		for (int i = 1; i < T; i++) {
			wet[i] += wet[i - 1];
			if (wet[i] > 0) ans++;
		}
		cout << ans << endl;
	}
}
