#include<bits/stdc++.h>
const int maxn=300;
inline const void read(int &a)
{
a=0;
char c=getchar();
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
inline const void write(int a)
{
if(a>=10)write(a/10);
putchar(a%10+'0');
}
int d=0,n,dis[maxn],step,point[maxn],to[maxn],next[maxn],big=-1;
bool been[maxn];
inline const void add(int a,int b)
{
next[++d]=point[a];
to[d]=b;
point[a]=d;
}
const void dfs(int p)
{
big=std::max(big,dis[p]);
been[p]=true;
int side=point[p];
while(side>=0)
{
if(!been[to[side]]){dis[to[side]]=dis[p]+1;dfs(to[side]);}
side=next[side];
}
}
int main()
{
memset(been,false,sizeof(been));
memset(dis,0,sizeof(dis));
memset(point,-1,sizeof(point));
read(n);read(step);step++;
int x,y;
for(int i=1;i<=n-1;i++)
{read(x);read(y);add(x,y);add(y,x);}
dis[0]=1;
dfs(0);
if(step<=big)write(step);
else
{
int rest=(step-big)/2,ans=rest+big;
write(ans);
}
return 0;
}