Suppose you have two arrays $$$c$$$ and $$$d$$$, each of length $$$k$$$. The pair $$$(c, d)$$$ is called good if $$$c$$$ can be changed to $$$d$$$ by performing the following operation any number of times.
You are given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$, containing nonnegative integers not exceeding $$$m$$$.
You can perform two types of moves on these arrays any number of times:
Note that the elements of $$$a$$$ and $$$b$$$ may exceed $$$m$$$ at some point while performing the moves.
Find the minimum number of moves required to make the pair $$$(a, b)$$$ good.
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 \leq n, m \leq 2 \cdot 10^6$$$) — the length of arrays $$$a$$$ and $$$b$$$, and the maximum possible value in these arrays, respectively.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq m$$$) — denoting the array $$$a$$$.
The third line contains $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ ($$$0 \leq b_i \leq m$$$) — denoting the array $$$b$$$.
Additionally, it is guaranteed that the sum of all values of $$$n$$$ and the sum of all values of $$$m$$$ across all test cases do not exceed $$$2 \cdot 10^6$$$.
For each test case, output a single integer — the minimum number of moves required to make the pair $$$(a, b)$$$ good.
54 30 1 2 30 1 2 33 328 9 328 6 325 645 7 16 32 644 8 16 32 644 119 1 4 38 11 6 25 107 9 5 4 23 10 6 5 9
0 2 2 0 1
In the first case, we already have $$$a = b$$$.
In the second case, we can perform move $$$2$$$ on index $$$i = 2$$$ twice. The array $$$b$$$ becomes $$$[8, 8, 32]$$$. We can see that $$$(a, b)$$$ is now good.
In the third case, we can perform move $$$2$$$ on index $$$i = 1$$$, then perform move $$$1$$$ on index $$$i = 2$$$. It can be proven that you cannot make the pair $$$(a, b)$$$ good in fewer than $$$2$$$ moves.