import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] arr = new int[n + m];
int index = 0;
while(sc.hasNextInt()) {
arr[index++] = sc.nextInt();
}
Arrays.sort(arr);
for(int i = 0 ; i < n + m ; i++) {
System.out.print(arr[i] + " ");
}
}
}