#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int loki [100001];
int ans=0;
int n;
int k;
cin >> n ;
cin >> k;
for (int i=0;i<n;i++){
cin >> loki[i];
}
for (int i=0; i<n;i++){
ans =max (ans,loki[i+k]);
}
cout<<ans+1<<endl;
return 0;
}