#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
  int t, n, k, a[35], b[35];
  while (~scanf("%d", &t)) {
    while (t--) {
      memset(a, 0, sizeof(a)), memset(b, 0, sizeof(b));
      scanf("%d %d", &n, &k);
      for (int i = 0; i < n; i++) scanf("%d", &a[i]);
      for (int i = 0; i < n; i++) scanf("%d", &b[i]);
      sort(a, a + n), sort(b, b + n, cmp);
      int ans = 0, i;
      for (i = 0; i < k; i++) ans += max(a[i], b[i]);
      while (i < n) ans += a[i], i++;
      printf("%d\n", ans);
    }
  }
  return 0;
}
