#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int n, m, c, t[2006];
void ikun()
{
	cin >> n >> m;
	for (int i = 1; i <= n + m; i++) cin >> t[i];
	sort(t+1 ,t+1+n+m);
	for (int i = 1; i <= n + m; i++)  cout << t[i] << " ";
}
int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ikun();
	return 0;
}