#include <stdio.h>
int main()
{
    int n,m = 0;
    scanf("%d%d",&n,&m);
    int arr1[100000];
    int arr2[100000];
    int i,j,ret = 0;
    ret = m+n;
    for(i=0;i<n;i++)
    {
        scanf("%d",&arr1[i]);
    }
    for(j=n;j<ret;j++)
    {
        scanf("%d",&arr2[j]);
    }
    for(i=n;i<ret;i++)
    {
        arr1[i] = arr2[i];
    }
    //冒泡排序
    for(i=1;i<ret;i++)
    {
        for(j=0;j<ret-i;j++)
        {
            if(arr1[j+1]<arr1[j])
            {
                int mid = 0;
                mid = arr1[j];
                arr1[j] = arr1[j+1];
                arr1[j+1] = mid;
            }
        }
    }
    for(i=0;i<ret;i++)
    {
        printf("%d ",arr1[i]);
    }

    return 0;
}