import java.util.*;
public class Main {
public static int n;
public static int m;
public static int[][] arr;
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int n = kb.nextInt();
int k = kb.nextInt();
Integer[] a = new Integer[n];
for(int i = 0; i < a.length; i++) a[i] = kb.nextInt();
Integer[] b = new Integer[n];
for(int i = 0; i < b.length; i++) b[i] = kb.nextInt();
Arrays.sort(a);
Arrays.sort(b, Comparator.reverseOrder());
//바꾼 횟수 계산
int cnt = 0;
for(int i = 0; i < n; i++) {
if(cnt == k) break;
if(a[i] < b[i]) {
cnt++;
int temp = a[i];
a[i] = b[i];
b[i] = temp;
}else break;
}
System.out.println(Arrays.toString(a));
}
}