#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int ar[n], br[n];
    for (int i = 0; i < n; i++) {
      cin >> ar[i];
    }
    for (int i = 0; i < n; i++) {
      cin >> br[i];
    }
    sort(ar, ar + n);
    sort(br, br + n);
    int i = 0, j = n - 1;
    while (ar[i] < br[j] && k > 0) {
      int swap = ar[i];
      ar[i] = br[j];
      br[j] = swap;
      k -= 1;
      i += 1;
      j -= 1;
    }
    int sum = 0;
    for (int i = 0; i < n; i++) {
      sum += ar[i];
    }
    cout << sum << "\n";
  }
  return 0;
}
