#include <iostream> #include<queue> using namespace std; int main() { int n,m; while(cin>>n>>m){ if(!n && !m) break; priority_queue<int,vector<int>,less<int>>pq; int *arr=(int *)malloc(sizeof(int)*n); for(int i=0;i<n;++i){ cin>>arr[i]; pq.push(arr[i]); } while(m-- && !pq.empty()){ cout<<pq.top()<<" "; pq.pop(); } cout<<endl; } }