#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    vector<long long> v, v1;
    for (long long i = 0; i < a; i++) {
      long long c;
      cin >> c;
      v.push_back(c);
    }
    for (long long i = 0; i < a; i++) {
      long long c;
      cin >> c;
      v1.push_back(c);
    }
    sort(v.begin(), v.end());
    sort(v1.rbegin(), v1.rend());
    long long k = 0;
    long long i = 0, j = 0;
    while (k < b && i < a) {
      if (v[i] < v1[j]) {
        v[i] = v1[j];
        j++;
        k++;
      }
      i++;
    }
    long long sum = 0;
    for (long long i = 0; i < a; i++) {
      sum = sum + v[i];
    }
    cout << sum << endl;
  }
  return 0;
}
