#include <iostream>
using namespace std;
const int N=2000010;
int a[N];
void QuickSort(int a[],int low,int high)
{
int i=low,j=high;
int t;
if(i>=j)
return;
int temp=a[low];
while(i!=j)
{
while(a[j]>=temp&&i<j)
j--;
while(a[i]<=temp&&i<j)
i++;
if(i<j)
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
a[low]=a[i];
a[i]=temp;
QuickSort(a,low,i-1);
QuickSort(a,i+1,high);
}
int main()
{
int m,n,i;
cin>>n>>m;
for(i=0;i<m;i++)
{
cin>>a[i];
}
QuickSort(a,0,m-1);
for(i=0;i<m;i++)
{
cout<<a[i]<<' ';
}
return 0;
}