#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int M=2e5+10;
long long now=1;
long long cnt;
int n,k;
long long a[M];
int main(){
freopen("ntarsis_set.in","r",stdin);
freopen("ntarsis_set.out","w",stdout);
cin>>n>>k;
for(long long i=0;i<n;i++){
cin>>a[i];
}
if(a[0]>1){
cout<<1<<endl;
return 0;
}
while(k--){
now+=cnt;
while(a[cnt]<=now&&cnt<n){
now++;
cnt++;
}
}
cout<<now<<endl;
return 0;
}