//题目1431:Sort
#include<iostream>
#include<string.h>
using namespace std;
int so[1000010];
int main(){
int N,m;
int t;
int max=0;
while(cin>>N>>m){
memset(so,0,sizeof(so));
while(N--){
cin>>t;
so[t+500000]++;
if(t>max) max=t;
}
for(int i=max+500000;i>=0;)
{
while(m!=1)
{
if(so[i]!=0){
so[i]--;
cout<<i-500000<<" ";
m--;
}
else i--;
}
while(m!=0)
{
if(so[i]!=0){
so[i]--;
cout<<i-500000<<endl;
m--;
}
else i--;
}
break;
}
}
}
#include<iostream>
#include<string.h>
using namespace std;
int so[1000010];
int main(){
int N,m;
int t;
int max=0;
while(cin>>N>>m){
memset(so,0,sizeof(so));
while(N--){
cin>>t;
so[t+500000]++;
if(t>max) max=t;
}
for(int i=max+500000;i>=0;)
{
while(m!=1)
{
if(so[i]!=0){
so[i]--;
cout<<i-500000<<" ";
m--;
}
else i--;
}
while(m!=0)
{
if(so[i]!=0){
so[i]--;
cout<<i-500000<<endl;
m--;
}
else i--;
}
break;
}
}
}