# include <cstdio>
# include <vector>
# include <algorithm>
# define REP(i, n) for (int i = 1; i <= n; ++ i)

using namespace std;
int n, K;
vector <int> e[2010];

int dfs (int x, int fa, int d) {
	if (d > K) return 0;
	int sz = 1;
	for (int v : e[x]) if (v != fa) sz += dfs (v, x, d + 1);
	return sz;
}

int main () {
	scanf ("%d%d", &n, &K); int t1, t2;
	REP (i, n - 1) 
		scanf ("%d%d", &t1, &t2), e[t1].push_back (t2), e[t2].push_back (t1);
	if (K % 2 == 0) {
		int ans = n; K /= 2;
		REP (i, n) ans = min (ans, n - dfs (i, 0, 0));
		printf ("%d\n", ans);
	} else {
		int ans = n; K /= 2;
		REP (x, n) for (int v : e[x]) ans = min (ans, n - dfs (x, v, 0) - dfs (v, x, 0));
		printf ("%d\n", ans);
	}
	return 0;
}
