There is a kingdom that has cities connected by
roads. All roads' length is
. The King wants to choose an area to be the capital of the kingdom. The area must have exactly
connected cities (the area of the capital is a connected component with exactly
cities). To show the importance of the capital, the King wants to minimize the maximum value of all the
cities.
We define the value of a city as the minimum distance between the city and one city which belongs to the capital. The distance between two cities is the length of the shortest path between them.
The first line of each test contains two integers
and
(
) --- the number of vertices and the number of cities of the capital, respectively.
Next
lines describe edges: the
-th line contains two integers
(
) --- indices of vertices connected by the
-th edge.
Print the minimum of the maximum value of all cities.