#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int a[n], b[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
      cin >> b[i];
    }
    sort(a, a + n);
    sort(b, b + n, greater<int>());
    int i = 0, j = 0;
    while (k > 0) {
      if (a[i] >= b[j]) {
        break;
      }
      int temp = b[j];
      b[j] = a[i];
      a[i] = temp;
      sort(b, b + n, greater<int>());
      i++;
      k--;
    }
    long long sum = 0;
    for (int i = 0; i < n; i++) sum += a[i];
    cout << sum << '\n';
  }
  return 0;
}
