#include <bits/stdc++.h>
using namespace std;
int a[40];
int b[40];
int main() {
  int t;
  cin >> t;
  int n, k;
  while (t--) {
    cin >> n >> k;
    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, a + n);
    sort(b, b + n);
    int p1 = 0, p2 = n - 1;
    while (k > 0) {
      if (a[p1] < b[p2]) {
        sum += b[p2] - a[p1];
        a[p1] = b[p2];
        p1++;
        p2--;
        k--;
      } else {
        break;
      }
    }
    cout << sum << endl;
  }
  return 0;
}
