_Stay_ @ 2023-04-19 16:53:27
#include<bits/stdc++.h>
using namespace std;
long long b,a[5000005],n,i,x;
int main()
{
scanf("%d%d",&n,&b);
b=b+1;
for(i=1;i<=n;i++)
{
scanf("%d",&x);
a[x]++;
}
for(i=0;i<=n;i++)
{
if(a[i]!=0) b-=1;
if(b<=0)
{
cout<<i;
break;
}
}
return 0;
}
by Mr_Biantainne @ 2023-04-19 17:01:37