program shorten_diameter
  implicit none
  integer, parameter :: infty = 100000000
  integer :: n, k, a, b, dist(2000,2000), i, j, m, c(2000), s, t
  dist = infty
  c = 0
  read(*,*) n, k
  do i = 1, n-1
    read(*,*) a, b
    dist(a,b) = 1
    dist(b,a) = 1
    dist(i,i) = 0
    c(a) = c(a)+1
    c(b) = c(b)+1
  end do
  dist(n,n) = 0
  do m = 1, n
    do i = 1, n
      do j = 1, n
        dist(i,j) = min(dist(i,j),dist(i,m)+dist(m,j))
      end do
    end do
  end do
  s = infty
  do i = 1, n
    if (c(i).ne.1) cycle
    t = 0
    do j = 1, n
      if (dist(i,j).gt.k) t = t+1
    end do
    s = min(s,t)
  end do
  write(*,'(i0)') s
  stop
end program shorten_diameter