#P1470A. Strange Birthday Party
Strange Birthday Party
Description
Petya organized a strange birthday party. He invited friends and assigned an integer to the -th of them. Now Petya would like to give a present to each of them. In the nearby shop there are unique presents available, the -th present costs dollars (). It's not allowed to buy a single present more than once.
For the -th friend Petya can either buy them a present , which costs dollars, or just give them dollars directly.
Help Petya determine the minimum total cost of hosting his party.
The first input line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and () — the number of friends, and the number of unique presents available.
The following line contains integers (), assigned by Petya to his friends.
The next line contains integers () — the prices of the presents.
It is guaranteed that sum of values over all test cases does not exceed , and the sum of values over all test cases does not exceed .
For each test case output a single integer — the minimum cost of the party.
Input
The first input line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and () — the number of friends, and the number of unique presents available.
The following line contains integers (), assigned by Petya to his friends.
The next line contains integers () — the prices of the presents.
It is guaranteed that sum of values over all test cases does not exceed , and the sum of values over all test cases does not exceed .
Output
For each test case output a single integer — the minimum cost of the party.
Note
In the first example, there are two test cases. In the first one, Petya has friends and available presents. Petya can spend only dollars if he gives
- dollars to the first friend.
- A present that costs dollars to the second friend.
- A present that costs dollars to the third friend.
- A present that costs dollars to the fourth friend.
- dollars to the fifth friend.
In the second one, Petya has and available presents. Petya can spend only dollars if he gives
- A present that costs dollars to the first friend.
- A present that costs dollars to the second friend.
- dollars to the third friend.
- dollars to the fourth friend.
- dollars to the fifth friend.