#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <sstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e9;
vector<int> dist[2020];
vector<int> edge[2020];
vector<int> e[2020];
int vis[2020];
int N,K;
int dfs1(int pos,int dis)
{
	int res = 0;
	vis[pos] = 1;
	if(dis>K/2) res++;
	for(int i = 0;i < dist[pos].size();i++){
		if(!vis[dist[pos][i]]){
			res += dfs1(dist[pos][i],dis+1);
			//cout<<"res:"<<res<<endl;
		}
	}
	return res;
}
int dfs2(int pos,int dis)
{
    int res = 0;
    vis[pos] = 1;
    if(dis>K/2) res++;
    for(int i = 0;i < e[pos].size();i++){
        if(!vis[e[pos][i]]){
            res += dfs2(e[pos][i],dis+1);
        }
    }
    return res;
}
int main()
{
	scanf("%d%d",&N,&K);
	for(int i = 1;i <= N-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		dist[a].push_back(b);
		dist[b].push_back(a);
		edge[a].push_back(i);
		edge[b].push_back(i);
	}
	for(int i = 1;i <= N;i++){
		if(edge[i].size()>=2){
			for(int j = 0;j < edge[i].size();j++){
				for(int k = j+1;k < edge[i].size();k++){
                    e[edge[i][j]].push_back(edge[i][k]);
                    e[edge[i][k]].push_back(edge[i][j]);
				}
			}
		}
	}
	if(K%2==0){
		int ans = INF;
		for(int i = 1;i <= N;i++){
			memset(vis,0,sizeof(vis));
			ans = min(dfs1(i,0),ans);
		}
		cout<<ans<<endl;
	}
	else{
		int ans = INF;
		for(int i = 1; i<= N-1;i++){
            memset(vis,0,sizeof(vis));
            ans = min(ans,dfs2(i,0));
		}
		cout<<ans<<endl;
	}
	return 0;
}
