Under construction

Still being built. Things may change

Gas stations

Time limit3.5sMemory limit1024 MB

Summary
Given a tree of N villages, find the fewest villages to mark so that every path of exactly k roads contains a marked village.
Level

Medium7 of 10

Topics
Dynamic programming, Tree
Solved
No attempts yet

Problem

The KOI country has NN villages, numbered 11 through NN. There are N−1N - 1 roads, and each road directly connects two different villages. The roads are also numbered 11 through N−1N - 1, and road ii connects village xix_i and village yiy_i. Any two villages in the KOI country are connected by exactly one path.

A path from village xx to village yy is a sequence of villages x,z1,z2,⋯ ,zt,yx, z_1, z_2, \cdots, z_t, y that satisfies both of the following:

  • Each pair of adjacent villages in the sequence is connected by a road.
  • No village appears more than once in the sequence.

The length of a path is the number of roads it uses, which is t+1t + 1.

You want to build gas stations in some of the villages. By KOI law, the stations must satisfy this condition:

  • Every path of length kk contains at least one village with a gas station.

Find the minimum number of gas stations that satisfies this condition.

Input

The first line contains NN and kk, separated by a space. Each of the next N−1N - 1 lines contains xix_i and yiy_i, the two villages connected by road ii, separated by a space.

Output

Print the minimum number of gas stations on the first line.

Constraints

  • 2≤N≤2000002 \le N \le 200000
  • 1≤k≤N−11 \le k \le N - 1
  • 1≤xi≤N1 \le x_i \le N, 1≤yi≤N1 \le y_i \le N, xi≠yix_i \ne y_i (1≤i≤N−11 \le i \le N - 1)
  • Any two villages are connected by exactly one path.
  • At least one path of length kk exists.
  • All input values are integers.

Examples2

  1. Example 1

    Input
    6 2
    1 2
    1 3
    2 4
    2 5
    4 6
    
    Expected output
    1
    
  2. Example 2

    Input
    7 2
    1 2
    1 3
    2 4
    2 5
    4 6
    6 7
    
    Expected output
    2