#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, 0);
    vector<int> b(n, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(), greater<int>());
    int ap = 0, bp = 0;
    while ((ap < n || bp < n) && (k > 0) && (a[ap] < b[bp])) {
      a[ap] = b[bp];
      ap++;
      bp++;
      k--;
    }
    int sum = 0;
    for (int i = 0; i < n; i++) sum += a[i];
    cout << sum << endl;
  }
}
