output_description: Print the minimum number of vertices that you need to remove in order to
  produce a good tree.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N K
      A_1 B_1
      A_2 B_2
      :
      A_{N-1} B_{N-1}
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
  
  Given an undirected tree, let the distance between vertices u and v be the
  number of edges on the simple path from u to v. The diameter of a tree is the
  maximum among the distances between any two vertices. We will call a tree
  _good_ if and only if its diameter is at most K.
  
  You are given an undirected tree with N vertices numbered 1 through N. For
  each i (1≦i≦N-1), there is an edge connecting vertices A_i and B_i.
  
  You want to remove zero or more vertices from the tree, so that the resulting
  tree is good. When a vertex is removed, all incident edges will also be
  removed. The resulting graph must be connected.
  
  Find the minimum number of vertices that you need to remove in order to
  produce a good tree.
samples: [{"input": "6 2\n    1 2\n    3 2\n    4 2\n    1 6\n    5 6", "output": "2\n    \n\nThe tree is shown below. Removing vertices 5 and 6 will result in a good tree\nwith the diameter of 2.\n\n![ctree.png](https://agc001.contest.atcoder.jp/img/agc/001/Gg9pvPKw/ctree.png)\n\n* * *"}, {"input": "6 5\n    1 2\n    3 2\n    4 2\n    1 6\n    5 6", "output": "0\n    \n\nSince the given tree is already good, you do not need to remove any vertex."}]