#include<iostream>
#include<vector>
using namespace std;
int main(){
    int t, d, l;
    while(cin >> t >> d >> l,t){
        int last = -2*d;
        int ans = 0;
        for(int i = 0; i < t-1; i++){
            int x;
            cin >> x;
            if(x >= l) last = i;
            if(last + d  > i) ans++;
        }
        int x;
        cin >> x;
        cout << ans << endl;
    }
}

