#include <bits/stdc++.h>
using namespace std;
int sum(int a[], int n) {
  int s = 0;
  for (int i = 0; i < n; i++) {
    s += a[i];
  }
  return s;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int a[n];
    int b[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      cin >> b[i];
    }
    sort(a, a + n);
    sort(b, b + n);
    if (a[0] >= b[n - 1]) {
      cout << sum(a, n) << endl;
    } else {
      int c = 0;
      int i = 0;
      int j = n - 1;
      while ((a[i] < b[j]) && c < k) {
        c++;
        a[i] = b[j];
        j--;
        i++;
      }
      cout << sum(a, n) << endl;
    }
  }
}
