#include <bits/stdc++.h>
using namespace std;
const unsigned long long MOD = 1e9 + 7;
int main() {
  int t, n, k;
  int a[31], b[31];
  bool fi = true;
  scanf("%d", &t);
  while (t--) {
    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);
    int i = 0, j = n - 1;
    for (int l = 0; l < k; l++) {
      if (a[i] < b[j])
        a[i++] = b[j--];
      else
        break;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) ans += a[i];
    if (fi) {
      fi = !fi;
      printf("%d", ans);
    } else
      printf("\n%d", ans);
  }
}
