#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    int t, d, l,result,condition;
    vector<int> v;
    while(cin>>t>>d>>l,(t!=0||d!=0||l!=0)){
        v.resize(t);
        result = 0;
        condition = 0;

        REP(i,t){
            cin >> v[i];
        }
        REP(i,t){
            if(v[i]>=l){
                condition = d;
            }else{
                condition--;
            }
            if(condition>0){
                result++;
            }
        }
        cout << max(result-1,0) << endl;
    }

    return 0;
}

