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