#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int a, b, y = 0;
    cin >> a >> b;
    int arr1[a], arr2[a];
    for (int i = 0; i < a; i++) {
      cin >> arr1[i];
    }
    for (int i = 0; i < a; i++) {
      cin >> arr2[i];
    }
    sort(arr1, arr1 + a);
    sort(arr2, arr2 + a, greater<int>());
    if (b == 0) {
      cout << accumulate(arr1, arr1 + a, y) << endl;
      continue;
    }
    for (int i = 0; i < a; i++) {
      if (arr1[i] < arr2[i]) {
        arr1[i] = arr2[i];
        b -= 1;
      }
      if (b <= 0) break;
    }
    cout << accumulate(arr1, arr1 + a, y) << endl;
  }
}
