#include <bits/stdc++.h>
using namespace std;
const long long M = 1e5 + 10;
long long kam[M], ziad[M];
void find() {
  long long a, b;
  cin >> a >> b;
  for (long long i = 0; i < a; i++) {
    long long s;
    cin >> s;
    kam[i] = s;
  }
  for (long long i = 0; i < a; i++) {
    long long s;
    cin >> s;
    ziad[i] = s;
  }
  for (long long i = 1; i <= b; i++) {
    sort(ziad, ziad + a);
    sort(kam, kam + a);
    if (ziad[a - 1] > kam[0]) {
      long long s = ziad[a - 1];
      ziad[a - 1] = kam[0];
      kam[0] = s;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < a; i++) {
    ans += kam[i];
  }
  cout << ans << endl;
}
int32_t main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    find();
  }
  return 0;
}
