#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll t,d,l;

template< class T >
struct CumulativeSum {
    vector< T > data;

    CumulativeSum(int sz) : data(sz, 0) {};

    void add(int k, T x) {
        data[k] += x;
    }

    void build() {
        for(int i = 1; i < data.size(); i++) {
            data[i] += data[i - 1];
        }
    }

    T query(int k){
        if(k < 0) return (0);
        return (data[min(k, (int) data.size() - 1)]);
    }

    T query(int l,int r){// 区間[l,r]
        return query(r) - query(l - 1);
    }
};

int main(){
    while(cin >> t >> d >> l && t){
        // cout << "!!" << t << endl;
        CumulativeSum<ll> cs(t);
        rep(i,t){
            ll num;
            cin >> num;
            if(num >= l){
                cs.add(i,1);
                if(i+d < cs.data.size())cs.add(i+d,-1);
            }
        }
        cs.build();
        ll ans = 0;
        rep(i,t-1){
            if(cs.data[i] > 0)ans++;
        }
        cout << ans << endl;
    }
}
