#include<iostream>
#include<cstdio>
using namespace std;
int n,k,A[2010],B[2010];
int h[2010],nxt[40010],to[40010],K=0;
int aa=0,bb=0;
void ins(int u,int v){nxt[++K]=h[u];h[u]=K;to[K]=v;}
int dfs(int x,int fa,int dep)
{
	int siz=0;
	for(int i=h[x];i;i=nxt[i])
		if(x==aa&&to[i]==bb||x==bb&&to[i]==aa||to[i]==fa)continue;
		else siz+=dfs(to[i],x,dep+1);
	if(dep>k/2)siz++;return siz;
 } 
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<n;i++)scanf("%d%d",&A[i],&B[i]),ins(A[i],B[i]),ins(B[i],A[i]);
	int ans=1e9;
	if(k&1)
	{
		for(int i=1;i<n;i++)
		{
			aa=A[i],bb=B[i];
			ans=min(ans,dfs(A[i],0,0)+dfs(B[i],0,0));
		}
	}
	else
	{
		for(int i=1;i<=n;i++)ans=min(ans,dfs(i,0,0));
	}
	printf("%d",ans);return 0;
 } 