#include <bits/stdc++.h>
using namespace std;
int getSum(const vector<int>& v) {
  int cnt = 0;
  for (int i : v) {
    cnt += i;
  }
  return cnt;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    vector<int> a, b;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      a.push_back(x);
    }
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      b.push_back(x);
    }
    if (k == 0) {
      cout << getSum(a) << endl;
      continue;
    } else {
      for (int j = 0; j < k; j++) {
        sort(a.begin(), a.end());
        sort(b.begin(), b.end());
        if (a[0] < b[n - 1]) {
          int const count = a[0];
          a[0] = b[n - 1];
          b[n - 1] = count;
        }
      }
    }
    cout << getSum(a) << endl;
  }
  return 0;
}
