#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   const int INF = 0x3f3f3f3f;   const int MOD = 1e9 + 7;   const double EPS = 1e-9;   int n, k, deg[1000015], ans, vis[1000015];   vector<int> e[1000015];   int dfs(int u) {     if (e[u].size() == 1) return 1;     vis[u] = 1;     vector<int> d;     for (int i = 0; i < e[u].size(); ++i) {       int v = e[u][i];       if (vis[v]) continue;       int x = dfs(v);       if (~x) d.push_back(x);     }     sort(d.begin(), d.end());     if (0 == d.size()) {       return -1;     } else if (1 == d.size()) {       if (d[0] >= k) {         ++ans;         return -1;       } else {         return ~d[0] ? d[0] + 1 : d[0];       }     }     int i = 0;     while (i + 1 < d.size() && d[i] + d[i + 1] <= k) ++i;     ans += d.size() - i - 1;     return ~d[i] ? d[i] + 1 : d[i];   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i < n; ++i) {       int u, v;       scanf( %d%d , &u, &v);       ++deg[u], ++deg[v];       e[u].push_back(v), e[v].push_back(u);     }     for (int i = 1; i <= n; ++i) {       if (1 != deg[i]) {         if (~dfs(i)) ++ans;         break;       }     }     printf( %d n , ans);     return 0;   }   