//In the name of God
#include<bits/stdc++.h>

using namespace std;

const int N = 2e3 + 100;
int n , k , a[N] , b[N] , res , now;
vector<int>e[N];

void dfs0(int v , int p = -1 , int h = 0){
	if(h > k / 2)
		return ;
	now++;
	for(auto u : e[v])
		if(u != p)
			dfs0(u , v , h+1);
}

void dfs1(int v , int x , int p = -1, int h = 0){
	if(h > k / 2)
		return ;
	now++;
	for(auto u : e[v])
		if(u != p && u != x)
			dfs1(u , x , v , h+1);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> k;	res = n;
	for(int i=1 ; i < n ; i++){
		cin >> a[i] >> b[i];
		e[a[i]].push_back(b[i]);
		e[b[i]].push_back(a[i]);
	}
	if(k&1){
		for(int i=1 ; i < n ; i++){
			now = 0;
			dfs1(a[i] , b[i]);
			dfs1(b[i] , a[i]);
			res = min(res , n - now);
		}
	}
	else{
		for(int i=1 ; i <= n ; i++){
			now = 0;
			dfs0(i);
			res = min(res , n - now);
		}
	}
	cout << res;
	return 0;
}
