用 #include<algorithm>里的sort函数
#include<iostream>
#include<algorithm>
using namespace std;
int num[1000005];
int cmp(const int &a,const &b){
return a>b;
}
int main(){
int n,m,i;
//freopen("1.txt","r",stdin);
while(scanf("%d%d",&n,&m)!=EOF){
for(i=0;i<n;i++)
scanf("%d",&num[i]);
sort(num,num+n,cmp);
for(i=0;i<m;i++){
printf("%d",num[i]);
if(i!=m-1)
printf(" ");
}
printf("\n");
}
return 0;
}