#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int T, D, L;
  while(cin>>T>>D>>L,T+D+L!=0) {
    int ans = 0, elapse = 0;;
    for (int i = 0; i < T; i++) {
      int x; cin >> x;
      if (x >= L) {
        elapse = 1;
        if (i!=T-1) ans++;
      } else {
        if (elapse == D) {
          elapse = 0;
        } else if(elapse != 0) {
          elapse++;
          if (i!=T-1) ans++;
        }
      }
    }  
    cout << ans << endl;
  }
}

