There are N cities in the country Byteland. Each city has some special value associated with it. All the cities are connected to one another either via direct flights or a series of connecting flights. There are a total of N−1 flights available and it is always possible to reach any city from any other city thus the structure of flights between the cities in Byteland forms a tree. The fare of flight between two cities is given by the distance between the two cities in the tree.
Now Rohan books flights between the two cities if and only if their special value is equal. He wants to book the cheapest and distinct K flights. He follows the following rules while booking flights-
Input Format :
The first line contains two space-separated integers N and K denoting total number of cities and the total flights that Rohan needs to book. Each of the next N−1 lines contain 2 space separated integers u and v whcih denote that there exists a flight between the cities with number u and v. The next line contains N space-separated integers, where the ith integer denotes C[i] which denotes the special value associated with the city numbered i.
It is guaranteed the given input edges form a valid tree.
Output Format :
Print a single integer denoting the answer.
Constraints :
1≤N≤3×104
1≤C[i]≤109
1≤K≤(n×(n−1))/2
There are 5 flights with cost 0 i.e. each from the city to itself. Now the sixth flight is of cost 1.