include [HTML_REMOVED]
using namespace std;
template < typename T >
inline void read(T &x)
{
bool flag = x = 0;
char c;
while ((c = getchar()) < 48 || c > 57)
flag |= c == ‘-‘;
do
x = (x << 1) + (x << 3) + (c ^ 48);
while ((c = getchar()) > 47 && c < 58);
if (flag) x = -x;
}
char OUTPUT[20];
template < typename T >
inline void write(T x)
{
if (x < 0)
{
putchar(‘-‘);
x = -x;
}
int SIZE = 0;
do
{
OUTPUT[++SIZE] = x % 10 | 48;
x /= 10;
}while (x);
while (SIZE)
putchar(OUTPUT[SIZE–]);
}
template < typename T >
inline void writesp(T x)
{
write(x);
putchar(32);
}
template < typename T >
inline void writeln(T x)
{
write(x);
putchar(10);
}
const int L = 100005;
int a[L];
int main()
{
int n, m;
read(n);
read(m);
for (int i = 1; i <= n; i)
read(a[i]);
Heap_sort(a, 1, n);
for (int i = 1; i < m; i)
writesp(a[i]);
writeln(a[m]);
return 0;
}