	#include <bits/stdc++.h>

	int n, m, mx, ans, cnt, cur;
	std::vector<int> *g;

	void dfs(int u, int par, int dist) {
		if(dist * 2 <= m) {
			++cur;
		}
		else {
			++cnt;
			return;
		}
		for (int v: g[u]) {
			if(v != par) {
				dfs(v, u, dist + 1);
			}
		}
		return;
	}

	int main() {
		scanf("%d%d", &n, &m);
		g = new std::vector<int>[n + 1];
		for (int i = 1; i < n; ++i) {
			int u, v;
			scanf("%d%d", &u, &v);
			g[u].push_back(v);
			g[v].push_back(u);
		}
		for (int u = 1; u <= n; ++u) {
			mx = cur = 0;
			for (int v: g[u]) {
				cnt = 0;
				dfs(v, u, 1);
				if(m & 1) {
					mx = std::max(mx ,cnt);
				}
			}
			ans = std::max(ans, cur + mx);
		}
		printf("%d\n", n - ans - 1);
		return 0;
	}