For the IOR racing competition, you need to find the most suitable race course.
A region has $N$ cities connected by $N-1$ highways. Each highway is bidirectional, connects two distinct cities, and has an integer length measured in kilometers. Any two cities are connected by exactly one path. In other words, the cities and highways form a tree.
A race course is a path between a distinct start city and end city whose total length is exactly $K$ kilometers. To avoid collisions, no highway may be used more than once (so no city is visited more than once either). Because the path between any two cities in a tree is unique, this condition is automatically satisfied.
To reduce traffic congestion, among all paths whose total length is exactly $K$, you must find the one that uses the fewest highways (edges).
Cities are numbered from $0$ to $N-1$. The city numbers joined by a highway are between $0$ and $N-1$, and each highway length is an integer between 0 and 1,000,000. All cities are connected.
Print the number of highways in a path of total length exactly $K$ that uses the fewest highways. If no such path exists, print $-1$.
The first line contains the number of cities $N$ and the race course length $K$, separated by a space.
Each of the next $N-1$ lines describes one highway with three integers $u$, $v$, and $w$, meaning a highway of length $w$ connects city $u$ and city $v$.
Print, on a single line, the number of highways in a shortest (fewest-edge) path whose total length is exactly $K$. If no such path exists, print $-1$.