program Routea;
const maxn=100001; maxm=1000001;
var
n,k,i,x,y,ans,tot:longint;
needhelp,givehelp,a:array[0..maxn] of longint;
next,link:array[0..maxm] of longint;
v:array[0..maxn] of boolean;
procedure insert(x,y:longint);
begin
inc(tot); next[tot]:=a[x]; a[x]:=tot;
link[tot]:=y;
end;
procedure tree_dp(x:longint);
var leaf:boolean; i:longint;
begin
if v[x] then exit;
v[x]:=true;
i:=a[x];
needhelp[x]:=0; givehelp[x]:=maxlongint;
leaf:=true;
while i<>0 do
begin
if not v[link[i]] then
begin
leaf:=false;
tree_dp(link[i]);
if needhelp[x]<needhelp[link[i]] then
needhelp[x]:=needhelp[link[i]];
if givehelp[x]>givehelp[link[i]] then
givehelp[x]:=givehelp[link[i]];
end;
i:=next[i];
end;
if leaf then
begin
needhelp[x]:=1; givehelp[x]:=maxlongint div 2;
if needhelp[x]>k then
begin
ans:=ans+1;
givehelp[x]:=1; needhelp[x]:=0;
end;
exit;
end;
if givehelp[x]+needhelp[x]<=k then
begin
needhelp[x]:=0; inc(givehelp[x]);
exit;
end;
if needhelp[x]>=k then
begin
ans:=ans+1;
givehelp[x]:=1; needhelp[x]:=0;
exit;
end;
inc(givehelp[x]); inc(needhelp[x]);
if x=1 then ans:=ans+1;
end;
begin
assign(input,'routea.in'); reset(input);
assign(output,'routea.out'); rewrite(output);
readln(n,k);
for i:=1 to n-1 do
begin
read(x,y);
insert(x,y);
insert(y,x);
end;
tree_dp(1);
writeln(ans);
close(input); close(output);
end.