meeting
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

A new city has just been built. There're  interesting places numbered by positive numbers from  to .
In order to save resources, only exactly  roads are built to connect these  interesting places. Each road connects two places and it takes 1 second to travel between the endpoints of any road.
There is one person in each of the places numbered and they've decided to meet at one place to have a meal. They wonder what's the minimal time needed for them to meet in such a place. (The time required is the maximum time for each person to get to that place.)

输入描述:

First line two positive integers,  - the number of places and persons.
For each the following  lines, there're two integers  that stand for a road connecting place  and . It's guaranteed that these roads connected all  places.
On the following line there're  different positive integers  separated by spaces. These are the numbers of places the persons are at.

输出描述:

A non-negative integer - the minimal time for persons to meet together.
示例1

输入

复制
4 2
1 2
3 1
3 4
2 4

输出

复制
2

说明

They can meet at place 1 or 3.

备注: