#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
  
  while(1){
  
    int T, D, L;
    
    cin>>T>>D>>L;
    if( !T && !D && !L ) break;
    
    int ans = 0, prev = -1e9;
    
    for(int i=0;i<T;i++){
      
      int x;
      cin>>x;

      if( i <= prev + D ) ans++;
      
      if( x >= L ) prev = i;
      
    }
    
    cout<<ans<<endl;
    
  }
  
  return 0;
}

