import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

//cの高さkの木のサイズ
long count(long[][] g, bool[] used, long c, long k) {
    if(used[c]) {
        return 0;
    }
    used[c] = true;
    if(k <= 0) {
        return 0;
    }
    long ans = 1;
    foreach(v; g[c]) {
        ans += count(g, used, v, k-1);
    }
    return ans;
}

void main(){
    long n, k;
    readlnTo(n, k);

    auto g = new long[][](n);
    foreach(i; iota(n-1)) {
        long a, b;
        readlnTo(a, b);
        a--;
        b--;
        g[a] ~= b;
        g[b] ~= a;
    }
    long ans = n;
    foreach(i; iota(n)) {
        auto m = k/2;
        long s = 1;
        foreach(vi; g[i]) {
            auto used = new bool[](n);
            used[i] = true;
            s += count(g, used, vi, m);
        }
        if(k%2 == 1) {
            long t = 0;
            foreach(vi; g[i]) {
                auto used = new bool[][](2,n);
                used[0][i] = true;
                used[1][i] = true;
                t = max(t, count(g, used[0], vi, m+1) - count(g, used[1], vi, m));
            }
            s += t;
        }
        ans = min(ans, n-s);
    }
    writeln(ans);
}

