#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF = 1<<30;
const ll LINF = 1LL<<61;
const int MOD = 1e9+7;

int main(){
    int T,D,L;
    while(cin >> T >> D >> L,T|D|L){
        int wet = 0;
        int res = 0;
        vector<int> wave(T);
        for (int i = 0;i<T;i++){
            cin >> wave[i];
        }
        for (int t = 0; t < T-1; t++)
        {
            if (wave[t] >= L)
            {
                wet = D;
            }
            if (wet > 0)
                res++;
            wet--;
        }
        cout << res << endl;
    }
    return 0;
}
