Highways and King
There are towns conveniently labeled with in Flatland Kingdom and bidirectional highways are allowed to be built.
The -th highway can be built between cities and with cost .
The Flatland Road Company plans to build the () allowed highways with the least total cost to connect any of two cities directly or indirectly.
The King of Flatland is going to remove some of the highways from the list of the allowed highways. He would like to know the minimum number of highways to be removed to strictly increase the total cost.
Note that the total cost is considered as if no valid () highways exist after removing. It is also counted as «total cost strictly increases».
Input
Contains zero or more test cases and is terminated by end-of-file. For each test case:
The first line contains two integers and . The -th of the following lines contains .
Any two cities will be connected if all allowed highways are built.
The sum of does not exceed .
Output
For each case, print an integer which denotes the result.