#include <bits/stdc++.h>
using namespace std;
const int MAXn = 2000 + 10;
vector<int> vec, g[MAXn];
vector<pair<int, int> > edge;
int n, k, ans = MAXn;
bool flag[MAXn];
int bfs() {
	for (int i = 0, level = 0; i < vec.size() && level < k / 2; level++)
		for (int j = vec.size(); i < j; i++)
			for (int x = 0; x < g[vec[i]].size(); x++)
				if (!flag[g[vec[i]][x]]) {
					flag[g[vec[i]][x]] = true;
					vec.push_back(g[vec[i]][x]);
				}
	return n - (int)vec.size();
}
int main() {
	cin >> n >> k;
	if (k % 2) {
		for (int i = 0; i < n - 1; i++) {
			int a , b;
			cin >> a >> b;
			a--;b--;
			g[a].push_back(b);
			g[b].push_back(a);
			edge.push_back({a , b});
		}
		
		for (int i = 0; i < edge.size(); i++) {
			fill_n(flag, MAXn, 0);
			vec.clear();
			vec.push_back(edge[i].first);
			vec.push_back(edge[i].second);
			flag[edge[i].first] = flag[edge[i].second] = true;
			ans = min(ans , bfs());
		}
	}
	else {
		for (int i = 0; i < n - 1; i++) {
			int a , b;
			cin >> a >> b;
			a--;b--;
			g[a].push_back(b);
			g[b].push_back(a);
			edge.push_back({a , b});
		}
		
		for (int i = 0; i < n; i++) {
			fill_n(flag, MAXn, 0);
			vec.clear();
			vec.push_back(i);
			flag[i] = true;
			ans = min(ans, bfs());
		}
	}
	cout << ans;
	
	
}