Texts:
C - BROCODE
Ram and Shyam live in a city consisting of n JLR facilities and n – 1 roads. From each facility, you can get to another by moving along the roads. The facilities form a tree. Ram wants to reach Shyam’s facility. He starts from a facility represented by index x, and Shyam resides in a facility represented by index y. Now, Ram has postponed k tasks that he must complete before reaching Shyam. Each task corresponds to visiting a specific JLR facility, denoted by a1, a2, ..., ak. Ram can complete these tasks in any order. Given that he can travel between facilities in 1 minute if they are neighbors (directly connected by a road), Ram wants to know the minimum time he needs to spend traveling between JLR facilities to complete all tasks and then reach Shyam's facility. Keep in mind that Ram can visit the same facility multiple times if necessary.
INPUT
The first line of each test case contains two integers n and k (1 ≤ k ≤ n ≤ 200000) — the number of facilities and tasks, respectively.
The second line of each test case contains two integers x and y (1 ≤ x, y ≤ n) — facilities where Ram and Shyam initially stay, respectively.
The third line of each test case contains k integers a1, a2, …, ak (1 ≤ ai ≤ n) — indices of facilities Ram needs to come to do things.
The following n−1 lines contain a description of facilities, each line containing two integers vj and uj (1 ≤ uj, vj ≤ n) — indices of facilities connected by road j.
OUTPUT
In a single line, output the minimum number of minutes Ram needs on the road to complete all tasks and come to Shyam.
Subtask 1 - 1 ≤ n ≤ 1000 (30%)
Subtask 2 - 1 ≤ n ≤ 200000 (70%)