#include <stdio.h> int main() { int n, m; scanf("%d %d", &n, &m); int a[n], b[m]; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } for (int i = 0; i < m; i++) { scanf("%d", &b[i]); } int c[n+m]; for (int i = 0, j = 0, k = 0; i < m + n; i++) { if (j == n) { c[i] = b[k]; k++; continue; } if (k == m) { c[i] = a[j]; j++; continue; } if(a[j] < b[k]) { c[i] = a[j]; j++; } else { c[i] = b[k]; k++; } } for (int i = 0; i < m + n; i++) { printf("%d ", c[i]); } return 0 ; }