#include <bits/stdc++.h>

using namespace std;

void solve();

int main() {
#ifdef OFFLINE
	freopen("input.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	solve();
	return 0;
}

#define forn(i, n) for (int i=0; i<n; ++i)

const int N = 2001;
int n, k;
vector<int> g[N];

int dfs(int u, int par, int h) {
	if (h==0) return 1;
	int ret = 1;
	for (int v: g[u])
		if (v != par)
			ret += dfs(v, u, h-1);
	return ret;
}

void solve() {
	cin >> n >> k;
	forn(_, n-1) {
		int u, v; cin >> u >> v; --u, --v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int vmax = 0;
	if (k & 1) {
		forn(u, n)
			for (int v: g[u]) if (u < v)  {
				int vcur = 0;
				vcur += dfs(u, v, k/2);
				vcur += dfs(v, u, k/2);
				vmax = max(vmax, vcur);
			}
	} else {
		forn(u, n) {
			int vcur = dfs(u, -1, k/2);
			vmax = max(vmax, vcur);
		}
	}
	cout << n - vmax << endl;
}