#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

class SegmentTree{
public:
	int n = 1;
	vector<P> seg[2];		//0:最大	1:最小
	void init(int N){		//N要素のセグメントツリー作成
		while(n < N)n *= 2;
		rep(i,2)seg[i].resize(2*n);
		fill(all(seg[0]), P(-INF, -1));
		fill(all(seg[1]), P(INF, -1));
	}
	P cmp_min(P x, P y){
		if(x.fi == y.fi)return x.se < y.se ? x : y;
		return min(x, y);
	}
	P cmp_max(P x, P y){
		if(x.fi == y.fi)return x.se < y.se ? x : y;
		return max(x, y);
	}
	//kの値をxに変更
	void update(int k, int x, bool flag=false){
		k += n-1;
		seg[0][k] = seg[1][k] = P(x, k-(n-1));
		if(flag){seg[0][k] = P(-INF, -1);seg[1][k] = P(INF, -1);}
		while(k > 0){
			k = (k-1)/2;
			seg[0][k] = cmp_max(seg[0][k*2+1], seg[0][k*2+2]);
			seg[1][k] = cmp_min(seg[1][k*2+1], seg[1][k*2+2]);
		}
	}
	void erase(int k){
		update(k, -1, true);
	}
	P calc_max(int a, int b, int k, int l, int r){
		if(b <= l || r <= a)return P(-INF, -1);
		if(a <= l && r <= b)return seg[0][k];
		P vl = calc_max(a, b, k*2+1, l, (l+r)/2);
		P vr = calc_max(a, b, k*2+2, (l+r)/2, r);
		return cmp_max(vl, vr);
	}
	P calc_min(int a, int b, int k, int l, int r){
		if(b <= l || r <= a)return P(INF, -1);
		if(a <= l && r <= b)return seg[1][k];
		P vl = calc_min(a, b, k*2+1, l, (l+r)/2);
		P vr = calc_min(a, b, k*2+2, (l+r)/2, r);
		return cmp_min(vl, vr);
	}
	int get_max(int a, int b){return calc_max(a, b, 0, 0, n).se;}
	int get_min(int a, int b){return calc_min(a, b, 0, 0, n).se;}
};

class EulerTour{
public:
	vector<vector<int> > G;
	vector<int> vs, dep, idx;
	SegmentTree seg;
	int n;
	void init(int N){
		n = N;
		G.resize(N);dep.resize(N);
		idx.resize(N);seg.init(2*n-1);
	}
	void add_edge(int u, int v){
		G[u].pb(v);G[v].pb(u);
	}
	void dfs(int v, int par){
		idx[v] = vs.size();vs.pb(v);
		if(par != -1)dep[v] = dep[par]+1;
		rep(i,G[v].size())if(G[v][i] != par){
			dfs(G[v][i], v);vs.pb(v);
		}
	}
	void euler_tour(int root=0){
		dfs(root, -1);
		rep(i,2*n-1)seg.update(i, dep[vs[i]]);
	}
	int lca(int u, int v){
		return vs[seg.get_min(min(idx[u], idx[v]), max(idx[u], idx[v])+1)];
	}
	int distance(int u, int v){
		return dep[u]+dep[v]-2*dep[lca(u, v)];
	}
};

vector<P> edge;
int dis[2000][2000];
int n, k;
signed main(){
	scanf("%lld%lld", &n, &k);
	EulerTour tour;tour.init(n);
	rep(i,n-1){
		int x, y;
		scanf("%lld%lld", &x, &y);x--;y--;
		tour.add_edge(x, y);
		edge.pb(P(x, y));
	}
	tour.euler_tour();
	//rep(i,tour.vs.size())printf("%lld\n", tour.vs[i]+1);
	//rep(i,n)printf("%lld ", tour.dep[i]);
	//rep(i,n)rep(j,n)printf("*%lld %lld %lld*\n", i+1, j+1, tour.lca(i, j));
	rep(i,n)rep(j,n)dis[i][j] = tour.distance(i, j);
	
	int ans = INF;
	if(k%2 == 1){
		rep(i,edge.size()){
			int u = edge[i].fi, v = edge[i].se, res = 0;
			rep(j,n)res += min(dis[u][j], dis[v][j]) > k/2;
			chmin(ans, res);
		}
	}else{
		rep(i,n){
			int res = 0;
			rep(j,n)if(dis[i][j] > k/2)res++;
			chmin(ans, res);
		}
	}
	
	printf("%lld\n", ans);
	return 0;
}







Measured memory_bytes: 32000