#include <bits/stdc++.h>
using namespace std;

vector<int> g[2020];

int dfs(int curr, int prev, int d) {
	if (d < 0) return 0;
	int res = 1;
	for (int next : g[curr]) if (next != prev) {
		res += dfs(next, curr, d - 1);
	}
	return res;
}

int main() {
	int n, K;
	cin >> n >> K;

	for (int i = 0; i < n - 1; i++) {
		int u, v;
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}

	int ans = INT_MAX;
	if (K % 2 == 0) {
		for (int i = 0; i < n; i++) {
			ans = min(ans, n - dfs(i, -1, K / 2));
		}
	} else {
		for (int i = 0; i < n; i++) {
			for (int j : g[i]) {
				ans = min(ans, n - dfs(i, j, (K - 1) / 2) - dfs(j, i, (K - 1) / 2));
			}
		}
	}
	cout << ans << endl;
}