#include <bits/stdc++.h>
using namespace std;
int n, can;
long long a[10000], sol, k;
int main() {
  scanf("%d %lld", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sol = a[1];
  for (int i = 2; i <= n; i++) {
    if (sol > a[i])
      can++;
    else {
      sol = a[i];
      can = 1;
    }
    if (can == k) {
      printf("%lld\n", sol);
      return 0;
    }
  }
  printf("%lld\n", sol);
  return 0;
}
