import bisect def main(): n_tests = int(input()) for _ in range(n_tests): n, m = [int(i) for i in input().split()] ai = [int(i) for i in input().split()] bj = [int(i) for i in input().split()] ai.sort() for i in range(m): tmp = ai.pop(0) bisect.insort(ai, bj[i]) print(sum(ai)) main()