#include<bits/stdc++.h>
using namespace std;
const int m=200500;
int n,d;
struct edge{
int next,to;
}a[m];
int head[m],cnt;
void link(int u,int v){
a[++cnt].next=head[u];
head[u]=cnt;
a[cnt].to=v;
}
int v[m],dis[m];
int dfs(int x){
int tot=1;
if(v[x]==d) return tot;
for(int i=head[x];i;i=a[i].next){
int y=a[i].to;
if(!v[y]&&y!=1){
v[y]=v[x]+1;
tot+=dfs(y);
}
}
return tot;
}
int main(){
cin>>n>>d;
for(int i=1;i<n;i++){
int u,v;
cin>>u>>v;
link(u,v);
link(v,u);
}
v[1]=0;
cout<<dfs(1)-1;
}