output_description: Print the maximum total number of ingredients that Snuke's N servings of
  Skewer Meal can hold.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N
      L_1 L_2 ... L_{2N}
attempt: from collections import defaultdict
  
  
  def computeDist(tree, nk, i):
      visited = [0] * (nk[0] + 1)
      queue = []
      visited[i] = 1
      queue.append(i)
      dist = [0] * (nk[0] + 1)
      dist[i] = 0
      while queue:
          s = queue.pop(0)
          for u in tree[s]:
              if not visited[u]:
                  queue.append(u)
                  visited[u] = 1
                  dist[u] = dist[s] + 1
      return len([i for i in dist if i > nk[1] // 2])
  
  
  def minimumNodesToBeRemoved(tree, nk):
      noOfNodesAtDistKBy2 = [0] * (nk[0] + 1)
      for i in range(1, nk[0] + 1):
          noOfNodesAtDistKBy2[i] = computeDist(tree, nk, i)
      return min(noOfNodesAtDistKBy2[1:])
  
  
  def start():
      nk = [int(i) for i in input().split()]
      tree = defaultdict(list)
      for i in range(nk[0] - 1):
          uv = [int(i) for i in input().split()]
          tree[uv[0]].append(uv[1])
          tree[uv[1]].append(uv[0])
      return minimumNodesToBeRemoved(tree, nk)
  
  
  print(start())
  
problem_description: Statement
  
  Snuke is having a barbeque party.
  
  At the party, he will make N servings of _Skewer Meal_.
  
  ![](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/abbq.png)
  
  Example of a serving of Skewer Meal
  
  He has a stock of 2N skewers, all of which will be used in Skewer Meal. The
  length of the i-th skewer is L_i. Also, he has an infinite supply of
  ingredients.
  
  To make a serving of Skewer Meal, he picks 2 skewers and threads ingredients
  onto those skewers. Let the length of the shorter skewer be x, then the
  serving can hold the maximum of x ingredients.
  
  What is the maximum total number of ingredients that his N servings of Skewer
  Meal can hold, if he uses the skewers optimally?
samples: [{"input": "2\n    1 3 1 2", "output": "3\n    \n\nIf he makes a serving using the first and third skewers, and another using the\nsecond and fourth skewers, each serving will hold 1 and 2 ingredients, for the\ntotal of 3.\n\n* * *"}, {"input": "5\n    100 1 2 3 14 15 58 58 58 29", "output": "135"}]