After learning about the Artistic Balance Tree, Lizhous encountered the following problem.
You are given an array $$$a$$$ consisting of $$$n$$$ integers. You need to perform exactly $$$m$$$ operations on $$$a$$$ in order. Each operation consists of two steps. Specifically, in the $$$i$$$-th operation, you are given an integer $$$x_i$$$, and you will:
After performing all $$$m$$$ operations, your task is to find the minimum possible sum of all elements that remain unmarked.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 10^5$$$) — the length of $$$a$$$ and the number of operations.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$-10^9 \le a_i \le 10^9$$$) — the elements of $$$a$$$.
The third line contains $$$m$$$ integers $$$x_1, x_2, \ldots, x_m$$$ ($$$1 \le x_i \le n$$$) — the indices to be marked in each operation.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.
It is guaranteed that the sum of $$$m$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, output a single integer — the minimum possible sum of the unmarked elements after all operations.
67 41 2 3 4 5 6 71 2 3 47 41 -2 3 4 -5 -6 -77 6 5 47 521 -45 234 -8 423 12 -9876 6 6 6 67 5-21 45 -234 8 -423 -12 9877 7 7 7 77 3-1 2 -3 4 5 6 71 2 37 3-1 -2 -3 -4 -5 -6 -71 2 3
6-20-362-6372-25
In the first test case, one optimal operation sequence is as follows:
The unmarked elements are $$$1$$$, $$$2$$$, and $$$3$$$, and the answer is $$$1+2+3=6$$$.
In the second test case, one optimal operation sequence is as follows:
The unmarked elements are $$$-2$$$, $$$-5$$$, $$$-6$$$, and $$$-7$$$, and the answer is $$$(-2)+(-5)+(-6)+(-7)=-20$$$.