This page is still under construction.

Parts of this page are still being built. What you see may change.

Fuel

Time limit1sMemory limit128 MB

Summary
Find the maximum number of distinct vertices of a tree that can be visited by a walk of length at most m edges.
Level

Hard8 of 10

Topics
Tree, DFS, Greedy
Solved
No attempts yet

Problem

In the good old days, all nn towns of Byteland were joined by a dense network of two-way roads. The king of Byteland decided to cut down the number of roads, and as a result Byteland now has only n−1n-1 two-way roads joining pairs of towns, arranged so that there is exactly one route between any two towns. In other words, the road network forms a tree. All roads have the same length.

Byteasar drives a car whose tank holds exactly enough fuel to travel across mm roads. He wants to plan a trip that visits as many distinct towns as possible. He may start in any town, and his trip may end in any town, not necessarily the one he started from. While maximizing the number of visited towns he may drive along the same road several times, in either direction. Find the maximum number of distinct towns that can be visited on one full tank of fuel.

Input

The first line contains two integers nn and mm (2≤n≤500 0002 \le n \le 500\,000, 1≤m≤200 000 0001 \le m \le 200\,000\,000), where nn is the number of towns in Byteland (each town has a unique number from 11 to nn) and mm is the number of roads that can be traveled on one tank of fuel.

Each of the next n−1n-1 lines describes one road with two integers aa and bb (1≤a,b≤n1 \le a, b \le n), meaning towns aa and bb are connected by a two-way road.

Output

Print a single integer: the maximum number of distinct towns that can be visited on one full tank of fuel.

Hint

In the example above, Byteasar can visit at most five distinct towns. Several routes visit five towns for this input, for example 4→5→7→5→6→5→24 \to 5 \to 7 \to 5 \to 6 \to 5 \to 2 or 3→2→1→2→5→6→53 \to 2 \to 1 \to 2 \to 5 \to 6 \to 5.

Examples1

  1. Example 1

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