local n, k = io.read("*n", "*n")
local isodd = k % 2 == 1
local hk = math.floor((k + 1) / 2)
local edge = {}
for i = 1, n do
  edge[i] = {}
end
local edgelist = {}
for i = 1, n - 1 do
  local a, b = io.read("*n", "*n")
  table.insert(edge[a], b)
  table.insert(edge[b], a)
  edgelist[i] = {a, b}
end

local function solve(st1, st2)
  local tasks = {}
  local len = {}
  for i = 1, n do
    len[i] = -1
  end
  if isodd then
    len[st1], len[st2] = 1, 1
    tasks[1] = st1
    tasks[2] = st2
  else
    len[st1] = 0
    tasks[1] = st1
  end
  for i = 1, n do
    local src = tasks[i]
    for j = 1, #edge[src] do
      local dst = edge[src][j]
      if -1 == len[dst] then
        len[dst] = len[src] + 1
        table.insert(tasks, dst)
      end
    end
  end
  local c = 0
  for i = 1, n do
    if hk < len[i] then c = c + 1 end
  end
  return c
end
local mmi = math.min
local mincnt = 1000000007
if isodd then
  for i = 1, n - 1 do
    mincnt = mmi(mincnt, solve(edgelist[i][1], edgelist[i][2]))
  end
else
  for i = 1, n do
    mincnt = mmi(mincnt, solve(i))
  end
end
print(mincnt)
