时间复杂度如果是枚举高度的话<1e9
#include <bits/stdc++.h>
using namespace std;
const int N=1010;
typedef long long LL;
int main(){
LL n,high;
unordered_map<LL,LL> hash;
cin>>n>>high;
LL maxl=-1e9;
for(int i=1;i<=n;i++){
LL x;
scanf("%lld",&x);
hash[x]++;
maxl=max(maxl,x);
}
LL temp=0,ans=0,res;
for(int i=maxl;i>=1;i--){
ans+=temp;
if(hash[i]) temp+=hash[i];
if(ans==high){
res=i;
break;
}
}
cout<<res;
return 0;
}