#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k, a[30], b[30], i, j, t, sum = 0;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  sort(a, a + n);
  sort(b, b + n);
  i = 0;
  j = n - 1;
  while (k--) {
    if (a[i] < b[j]) {
      t = a[i];
      a[i] = b[j];
      b[j] = t;
      i++;
      j--;
    } else
      break;
  }
  for (i = 0; i < n; i++) {
    sum += a[i];
  }
  cout << sum << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
