#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), 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 x = 1, i, j;
    for (i = 0, j = n - 1; i < n && j >= 0;) {
      if (x <= k) {
        if (a[i] < b[j]) {
          sum -= a[i];
          sum += b[j];
          j--;
          i++;
          x++;
        } else
          break;
      } else
        break;
    }
    cout << sum << endl;
  }
}
