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

#define INF ((int)1e9)
int main(){
  int T, D, L;

  for(;;){
    int X, ans = 0;
    cin>>T>>D>>L;

    if(!T&&!D&&!L) break;

    for(int i = 0, num = INF; i < T-1; i++, num++){
      cin>>X;
      if(X >= L) num = 0;
      if(num < D) ans++;
    }

    cin>>X;

    cout<<ans<<endl;
  }
  return 0;
}

