There are several test cases, please keep reading until EOF.
For each test case, the first line consists of 2 integer $n, k$, which means the number of the tree nodes and the size of the permutaion, and $k$ means the number of parts.
The next line consists of $n$ different integers, which means the permutation $P$.
The next $n - 1$ lines consists of 2 integers, $a, b$, means a tree edge.
It is guaranteed that the edges would form a tree.
There are 6 test cases.