#AGC001C. [AGC001C] Shorten Diameter

[AGC001C] Shorten Diameter

Score : 600600 points

Problem Statement

Given an undirected tree, let the distance between vertices uu and vv be the number of edges on the simple path from uu to vv. The diameter of a tree is the maximum among the distances between any two vertices. We will call a tree good if and only if its diameter is at most KK.

You are given an undirected tree with NN vertices numbered 11 through NN. For each i(1iN1)i (1 \leq i \leq N-1), there is an edge connecting vertices AiA_i and BiB_i.

You want to remove zero or more vertices from the tree, so that the resulting tree is good. When a vertex is removed, all incident edges will also be removed. The resulting graph must be connected.

Find the minimum number of vertices that you need to remove in order to produce a good tree.

Constraints

  • 2N20002 \leq N \leq 2000
  • 1KN11 \leq K \leq N-1
  • 1AiN,1BiN1 \leq A_i \leq N, 1 \leq B_i \leq N
  • The graph defined by AiA_i and BiB_i is a tree.

Input

The input is given from Standard Input in the following format:

NN KK

A1A_1 B1B_1

A2A_2 B2B_2

:

AN1A_{N-1} BN1B_{N-1}

Output

Print the minimum number of vertices that you need to remove in order to produce a good tree.

6 2
1 2
3 2
4 2
1 6
5 6
2

The tree is shown below. Removing vertices 55 and 66 will result in a good tree with the diameter of 22.

ctree.png

6 5
1 2
3 2
4 2
1 6
5 6
0

Since the given tree is already good, you do not need to remove any vertex.