import java.util.*

val r = Array<ArrayList<Int>>(2001) { ArrayList<Int>() }

fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map(String::toInt)
    for (i in 1..n - 1) {
        val (a, b) = readLine()!!.split(' ').map(String::toInt)
        r[a].add(b)
        r[b].add(a)
    }
    var ans = 0
    for (i in 1..n) {
        if (k % 2 == 1) {
            for (rr in r[i]) {
                ans = Math.max(ans, dfs(rr, i, k / 2) + dfs(i, rr, k / 2))
            }
        } else {
            ans = Math.max(ans, dfs(i, -1, k / 2))
        }
    }
    println(n - ans)
}

fun dfs(v : Int, p : Int, q : Int) : Int {
    if (q < 0) return 0
    var res = 1
    for (rr in r[v]) if (rr != p) {
        res += dfs(rr, v, q - 1)
    }
    return res
}