#include <bits/stdc++.h>
using namespace std;
int sum(vector<int> a) {
  int sum = 0;
  for (int i = 0; i < a.size(); i++) {
    sum += a[i];
  }
  return sum;
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<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.begin(), a.end());
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  if (k == 0) {
    cout << sum(a) << '\n';
    return;
  }
  for (int i = 0, j = 0; i < n; i++) {
    if (a[i] < b[j]) {
      k--;
      a[i] = b[j];
      j++;
    }
    if (k == 0) break;
  }
  cout << sum(a) << '\n';
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) solve();
}
