#include <iostream>
#include <cstdio>
#include <vector>
#define N 2005
using namespace std;

int n, k, mx;
bool v[N];
vector<int> a[N];

int f(int p, int q) {
	int i, s = 0;
	if (q < 0) return 0;
	if (v[p]) return 0;
	v[p] = 1;
	for (i = 0; i < a[p].size(); i++) s += f(a[p][i], q - 1);
	v[p] = 0;
	return s + 1;
}

int main()
{
	int i, j, t1, t2;
	cin >> n >> k;
	for (i = 1; i < n; i++) {
		scanf("%d %d", &t1, &t2);
		a[t1].push_back(t2);
		a[t2].push_back(t1);
	}
	if (k % 2 == 0) {
		for (i = 1; i <= n; i++) {
			mx = max(mx, f(i, k / 2));
		}
	} else {
		for (i = 1; i <= n; i++) {
			for (j = 0; j < a[i].size(); j++) {
				v[a[i][j]] = 1; t1 = f(i, k / 2); v[a[i][j]] = 0;
				v[i] = 1; t1 += f(a[i][j], k / 2); v[i] = 0;
				mx = max(mx, t1);
			}
		}
	}
    cout << n - mx << endl;
    return 0;
}