#GYM104786D. Many biscuits
Many biscuits
Description
John has a rooted tree with $n$ vertices numbered form $1$ to $n$. The root of the tree is the vertex $1$.
In the beginning in each vertex there is exactly one biscuit. John wants to eat $k$ meals. In each meal he chooses a vertex $x$ and eats all the remaining biscuits on the unique simple path from $x$ to the root. Of course, each biscuit can be eaten only once.
John likes biscuits very much and he asks you what is the maximum number of biscuits he can eat in $k$ meals if he chooses wisely.
The first line of the input contains two integers $n$ and $k$ $(2 \le n, k \le 5 \cdot 10^5)$ - the number of vertices in the tree and the number of meals.
Each of the next $n - 1$ lines contain two integers $u$ and $v$ $(1 \leq u, v \leq n; u \neq v)$ denoting there is an undirected edge between node $u$ and node $v$. It is guaranteed that the given edges form a tree.
Print the maximum number of biscuits that John can eat in his $k$ meals.
Input
The first line of the input contains two integers $n$ and $k$ $(2 \le n, k \le 5 \cdot 10^5)$ - the number of vertices in the tree and the number of meals.
Each of the next $n - 1$ lines contain two integers $u$ and $v$ $(1 \leq u, v \leq n; u \neq v)$ denoting there is an undirected edge between node $u$ and node $v$. It is guaranteed that the given edges form a tree.
Output
Print the maximum number of biscuits that John can eat in his $k$ meals.
5 2
1 2
1 3
2 4
2 5
4
Note
For the first meal he can choose vertex $4$ and eat $3$ biscuits (vertices $4$, $2$, $1$).
For the second meal he can choose vertex $5$ and eat $1$ biscuit (the biscuits from vertices $2$ and $1$ were eaten in the first meal).