Kth Subtree

아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

You are given an unrooted labeled tree. A subtree is a connected subgraph of this tree. The size of a subtree is the number of nodes in the subtree. Two subtrees are different if there is at least one node which is in one but not the other. The largest subtree is the original tree itself.

Compute the size of the KKth smallest non-empty subtree.

입력

The first line of input contains two integers nn (1n5,0001 \le n \le 5,000) and KK (1K10181 \le K \le 10^{18}), where nn is the number of nodes in the tree, and you’re looking for the size of the KKth smallest subtree. The nodes are numbered 11 through nn.

Each of the next n1n - 1 lines contains a pair of integers uu and vv (1u,v n1 \le u, v \le n, uvu \ne v), which represents an undirected edge between nodes uu and vv. All edges are distinct. It is guaranteed that the edges form a single tree.

출력

Output a single integer, which is the number of nodes in the KKth smallest non-empty subtree of the input tree. If there are fewer than KK non-empty subtrees of the given tree, output 1-1.