# 描述

The nation of Panel holds an annual show called The Number Games, where each district in the nation will be represented by one contestant.

The nation has $n$ districts numbered from $1$ to $n$, each district has exactly one path connecting it to every other district. The number of fans of a contestant from district $i$ is equal to $2^i$.

This year, the president decided to reduce the costs. He wants to remove $k$ contestants from the games. However, the districts of the removed contestants will be furious and will not allow anyone to cross through their districts.

The president wants to ensure that all remaining contestants are from districts that can be reached from one another. He also wishes to maximize the total number of fans of the participating contestants.

Which contestants should the president remove?

## Input

The first line of input contains two integers $n$ and $k$ ($1 ≤ k < n ≤ 10 ^ 6$) the number of districts in Panel, and the number of contestants the president wishes to remove, respectively.

The next $n-1$ lines each contains two integers $a$ and  ($1≤a,b≤n$, $a≠b$), that describe a road that connects two different districts $a$ and $b$ in the nation. It is guaranteed that there is exactly one path between every two districts.

## Output

Print $k$ space-separated integers: the numbers of the districts of which the contestants should be removed, in increasing order of district number.

Input Output

## Note

In the first sample, the maximum possible total number of fans is $2 ^ 2 + 2 ^ 5 + 2 ^ 6 = 100$. We can achieve it by removing the contestants of the districts $1$, $3$, and $4$.

# 思路

• 题意：一棵有$n$个点的树，每个点的权值为$2^i$。现在要求去掉$k$个点，剩余的点保持连通的情况下，权值最大。
• 一个比较显然的结论是：$2 ^ n > \sum\limits_{i=0} ^ {n - 1}{2 ^ i}$，也就是说，我们要尽可能的留下编号较大的点。
• 于是可以考虑从第$n$个点开始贪心，为了保持连通性，我们取第$i$个点，就要将它与要保留的点集的路径上的点都要保留，如果需要保留的结点加上已经保留的结点超过了$n-k$，那就不能保留。
• 那么现在的问题就是要处理如何维护一个点到要保留的点集的路径上的结点个数。
• 在最开始，每个点到$n$的路径上的结点个数就是深度，而每次选择一个点，那么这条路径上每个点的子树上的每个点都会少一个这样的点，在dfs序下就是一个区间更新。拿数据结构维护一下就好了。

0%