#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int T,D,L;
  while(1){
    cin>>T>>D>>L;
    if(T==0)
      break;
    vector<int> x(T,0);
    int ans=0,last=-1;
    
    for(int i=0;i<T;i++){
      cin>>x[i];
    }

    for(int i=0;i<T;++i){
      if(i-D<=last && last>=0)
        ans++;
      if(x[i]>=L)
        last=i;
    }

    cout<<ans<<endl;
  }
}

