It's easy to notice that we have a complete bipartite graph with **K** nodes. One set contains the nodes of the **K** specialists. The other contains the nodes of the **K** servers.

It is complete because we have a path between any pair of nodes.

Now, the answer for the problem is the minimum cost such that if we consider only the edges with cost less or equal to that cost, we have a perfect match. If we increase that cost, the match can only increase or stay the same.

Therefore, we can binary search for the answer.