| 记录编号 | 
        584953 | 
        评测结果 | 
        AAAAAAAAAAAAAAAAAAAA | 
    
    
        | 题目名称 | 
        3905.[CF1852A] Ntarsis Set | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         ムラサメ | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.052 s  | 
    
    
        | 提交时间 | 
        2023-11-17 14:23:08 | 
        内存使用 | 
        3.33 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,flag=0,ans=1;
ll a[200010];
int main(){
	freopen("ntarsis_set.in","r",stdin);
	freopen("ntarsis_set.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>k;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
	}
	while(k--){
		ans+=flag;
		while(flag<n&&a[flag+1]<=ans){
			ans++;
			flag++;
		}
	}
	cout<<ans<<endl;
	return 0;
}