// Shaazzz
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, k;
pair < int , int > dp[N];
vector < int > Adj[N];
void DFS(int v, int p)
{
int Mx1 = 0, Mx2 = 0;
for (int &u : Adj[v])
if (u != p)
{
DFS(u, v);
dp[v].first += dp[u].first;
if (dp[u].second >= Mx2)
Mx2 = dp[u].second;
if (Mx2 >= Mx1)
swap(Mx1, Mx2);
}
if (Mx1 + Mx2 + 1 >= k + 1)
dp[v].first ++;
else
dp[v].second = Mx1 + 1;
}
int main()
{
scanf("%d%d", &n, &k);
for (int i = 1; i < n; i++)
{
int v, u;
scanf("%d%d", &u, &v);
Adj[v].push_back(u);
Adj[u].push_back(v);
}
DFS(1, 0);
return !printf("%d", dp[1].first);
}
Ly8gU2hhYXp6egojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgTiA9IDFlNiArIDEwOwppbnQgbiwgazsKcGFpciA8IGludCAsIGludCA+IGRwW05dOwp2ZWN0b3IgPCBpbnQgPiBBZGpbTl07CnZvaWQgREZTKGludCB2LCBpbnQgcCkKewogICAgaW50IE14MSA9IDAsIE14MiA9IDA7CiAgICBmb3IgKGludCAmdSA6IEFkalt2XSkKICAgICAgICBpZiAodSAhPSBwKQogICAgICAgIHsKICAgICAgICAgICAgREZTKHUsIHYpOwogICAgICAgICAgICBkcFt2XS5maXJzdCArPSBkcFt1XS5maXJzdDsKICAgICAgICAgICAgaWYgKGRwW3VdLnNlY29uZCA+PSBNeDIpCiAgICAgICAgICAgICAgICBNeDIgPSBkcFt1XS5zZWNvbmQ7CiAgICAgICAgICAgIGlmIChNeDIgPj0gTXgxKQogICAgICAgICAgICAgICAgc3dhcChNeDEsIE14Mik7CiAgICAgICAgfQogICAgaWYgKE14MSArIE14MiArIDEgPj0gayArIDEpCiAgICAgICAgZHBbdl0uZmlyc3QgKys7CiAgICBlbHNlCiAgICAgICAgZHBbdl0uc2Vjb25kID0gTXgxICsgMTsKfQppbnQgbWFpbigpCnsKICAgIHNjYW5mKCIlZCVkIiwgJm4sICZrKTsKICAgIGZvciAoaW50IGkgPSAxOyBpIDwgbjsgaSsrKQogICAgewogICAgICAgIGludCB2LCB1OwogICAgICAgIHNjYW5mKCIlZCVkIiwgJnUsICZ2KTsKICAgICAgICBBZGpbdl0ucHVzaF9iYWNrKHUpOwogICAgICAgIEFkalt1XS5wdXNoX2JhY2sodik7CiAgICB9CiAgICBERlMoMSwgMCk7CiAgICByZXR1cm4gIXByaW50ZigiJWQiLCBkcFsxXS5maXJzdCk7Cn0=