#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    vector<int> ans;
    int T, D, L;
    while(true){
        int res = 0;
        cin >> T >> D >> L;
        if(T == 0) break;
        int wet = 0;
        rep(i, T){
            if(wet > 0) res++;
            int x; cin >> x;
            if(L <= x) wet = D;
            else wet--;
        }
        ans.push_back(res);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}
