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

int main() {
    int T, D, L;
    while (cin >> T >> D >> L, T | D | L) {
        int x, cnt = 0, sum = 0;
        for (int i = 0; i < T; i++) {
            cin >> x;
            if (x >= L) {
                cnt = D;
            } else {
                cnt--;
                cnt = max(cnt, 0);
            }
            if (cnt > 0) sum++;
        }
        if (cnt > 0) sum--;
        cout << sum << endl;
    }
    return 0;
}
