# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, k;
int a[101010], b[101010];
vector<int> G[101010];

int d[101010];
int calc1(int p,int r) {
	REP(i, n)d[i] = -1;
	d[p] = 0;
	queue<int> q;
	q.push(p);
	while (q.size()) {
		int v = q.front();
		q.pop();
		REP(i, G[v].size()) {
			if (d[G[v][i]] != -1)continue;
			d[G[v][i]] = d[v] + 1;
			q.push(G[v][i]);
		}
	}
	int cnt = 0;
	REP(i, n) {
		if (d[i] > r / 2)cnt++;
	}
	return cnt;
}

int calc2(int p, int r) {
	REP(i, n)d[i] = -1;
	d[a[p]] = d[b[p]] = 0;
	queue<int> q;
	q.push(a[p]);
	while (q.size()) {
		int v = q.front();
		q.pop();
		REP(i, G[v].size()) {
			if (d[G[v][i]] != -1)continue;
			if (G[v][i] == b[p])continue;
			d[G[v][i]] = d[v] + 1;
			q.push(G[v][i]);
		}
	}
	q.push(b[p]);
	while (q.size()) {
		int v = q.front();
		q.pop();
		REP(i, G[v].size()) {
			if (d[G[v][i]] != -1)continue;
			if (G[v][i] == a[p])continue;
			d[G[v][i]] = d[v] + 1;
			q.push(G[v][i]);
		}
	}
	int cnt = 0;
	REP(i, n) {
		if (d[i] > (r-1) / 2)cnt++;
	}
	return cnt;
}

int main() {
	cin >> n >> k;
	REP(i, n - 1) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		G[a[i]].emplace_back(b[i]);
		G[b[i]].emplace_back(a[i]);
	}
	int ans = INF;
	for (int q = k - 1; q <= k; q++) {
		if (q % 2 == 0) {
			REP(i, n) {
				ans=min(calc1(i,q),ans);
			}
		}
		else {
			REP(i, n - 1) {
				ans = min(calc2(i, q), ans);
			}
		}
	}
	cout << ans << endl;
	//system("pause");
}

Measured memory_bytes: 2688