#include<iostream>
#include<cctype>
#include<queue>
#include<cstdio>
#include<cmath>
#include<sstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<ctime>
#include<cstdlib>
#include<map>
#include<utility>
#include<iomanip>
#include<set>
#include<stack>
//#include<Windows.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> vii;
int n,k,a,b,d[2005],ans,mx,root;
vector<int> v[2005],leaf;
queue<int> q;
int main()
{
// 	freopen("shorten diameter.txt","r",stdin);
	cin>>n>>k;
	for(int i=0;i<n-1;i++){
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for(int i=1;i<=n;i++){
		if(v[i].size()>mx){
			mx=v[i].size();
			root=i;
		}
		if(v[i].size()==1)
			leaf.push_back(i);
	}
	fill(d,d+n+1,5000);
	q.push(root);d[root]=0;
	while(!q.empty()){
		a=q.front();q.pop();
	//	cout<<a<<' '<<d[a]<<endl;
		for(int i=0;i<v[a].size();i++){
			int t=v[a][i];
			if(d[t]>1+d[a]){
				d[t]=d[a]+1;
				q.push(t);
			//	cout<<'*'<<t;
			}
		}
	//	cout<<endl;
	}
	for(int i=0;i<leaf.size();i++){
		if(d[leaf[i]]>ceil(k/2.0))
			ans+=d[leaf[i]]-ceil(k/2.0);
	//	cout<<leaf[i]<<' '<<ans<<endl;
	}
	if(ans!=0&&k%2==1) ans++;
	cout<<ans<<endl;
	return 0;
}