hdu1412
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
typedef long long LL;
using namespace std;
int n, m;
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
while(scanf("%d %d", &n, &m) == 2){
set<int>st;
int x;
for (int i = 1; i <= n; i++){
scanf("%d", &x);
st.insert(x);
}
for (int i = 1; i <= m; i++){
scanf("%d", &x);
st.insert(x);
}
set<int>::iterator it = st.begin();
int flag = 0;
for (; it != st.end(); it++){
if(!flag){
printf("%d", *it);
flag = 1;
}else{
printf(" %d", *it);
}
}
printf("\n");
}
return 0;
}
/**/