#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int a[n], b[n];
    priority_queue<int> pq_max;
    priority_queue<int, vector<int>, greater<int>> pq_min;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      pq_min.push(a[i]);
    }
    for (int i = 0; i < n; i++) {
      cin >> b[i];
      pq_max.push(b[i]);
    }
    int cnt = 0;
    while (cnt != k) {
      int t1, t2;
      t1 = pq_min.top();
      t2 = pq_max.top();
      if (t1 < t2) {
        pq_max.pop();
        pq_min.pop();
        pq_max.push(t1);
        pq_min.push(t2);
      }
      cnt++;
    }
    int sum = 0;
    while (!pq_min.empty()) {
      sum += pq_min.top();
      pq_min.pop();
    }
    cout << sum << endl;
  }
  return 0;
}
