#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int T, D, L;
    while (cin >> T >> D >> L, T) {
        vector<int> flood(T + D);
        for (int i = 0; i < T; i++) {
            int x; cin >> x;
            if (x < L) continue;
            flood[i] += 1;
            flood[i + D] -= 1;
        }
        for (int i = 1; i < T + D; i++) flood[i] += flood[i - 1];
        int cnt = 0;
        for (int i = 0; i < T - 1; i++) if (flood[i]) cnt++;
        cout << cnt << endl;
    }
    return 0;
}
