#include <bits/stdc++.h> using namespace std; bool cmp(int a,int b) { return a>b; } int main(){ int n,m; while(cin>>n>>m) { if(n==0&&m==0) break; int val[n]; for(int i=0;i<n;i++) cin>>val[i]; sort(val,val+n,cmp); int cnt=min(n,m); for(int i=0;i<cnt-1;i++) cout<<val[i]<<" "; cout<<val[cnt-1]<<endl; } return 0; }