rt
这么写WA了,但感觉不用也没问题啊(
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5;
int a[maxn + 1];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, l;
cin >> n >> l;
for(int i = 0; i < n; ++ i)
cin >> a[i];
sort(a, a + n, [](int a, int b){
return a > b;
});
for(int i = 0; i < n; ++ i){
if(a[i] < i + 1 - 1){
cout << i << endl;
return 0;
}
else if(a[i] < i + 1){
if(l <= 0){
cout << i << endl;
return 0;
}
--l;
}
}
cout << n << endl;
return 0;
}