[ABC368D] 最小包含子虚树 (Minimum Steiner Tree)
Problem Statement
You are given a tree with vertices numbered to . The -th edge connects vertices and .
Consider a tree that can be obtained by removing some (possibly zero) edges and vertices from this graph. Find the minimum number of vertices in such a tree that includes all of specified vertices .
Input
The input is given from Standard Input in the following format:
$N$ $K$
$A_1$ $B_1$
$\vdots$
$A_{N-1}$ $B_{N-1}$
$V_1$ $\ldots$ $V_K$
Output
Print the answer.
Example
7 3
1 2
1 3
2 4
2 5
3 6
3 7
1 3 5
4
Note
-
Constraints:
-
-
-
-
The given graph is a tree.
-
All input values are integers.
-
Source: ABC368D