func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 10;   int n, k;   vector<int> g[N];   int fa[N];   int dep[N];   bool vis[N];   int anc[N][35];   void dfs(int u, int f) {     fa[u] = f;     anc[u][0] = fa[u];     for (int i = 0; i < g[u].size(); i++) {       int v = g[u][i];       if (v != f) {         dep[v] = dep[u] + 1;         dfs(v, u);       }     }   }   void rdfs(int u, int f) {     vis[u] = 1;     if (u == f) return;     rdfs(fa[u], f);   }   void preprocess() {     for (int j = 1; (1 << j) < n; j++) {       for (int i = 0; i < n; i++) {         if (anc[i][j - 1] != -1) {           int a = anc[i][j - 1];           anc[i][j] = anc[a][j - 1];         }       }     }   }   int main() {     memset(anc, -1, sizeof(anc));     scanf( %d%d , &n, &k);     k = n - k;     for (int i = 1; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       x--, y--;       g[x].push_back(y);       g[y].push_back(x);     }     dfs(n - 1, -1);     preprocess();     int num = 1;     vis[n - 1] = 1;     for (int i = n - 2; i >= 0; i--) {       if (vis[i]) continue;       int t = i;       for (int j = 20; j >= 0; j--) {         if (anc[t][j] == -1)           continue;         else {           if (!vis[anc[t][j]]) {             t = anc[t][j];           }         }       }       if (dep[i] - dep[t] + 1 + num <= k) {         num += dep[i] - dep[t] + 1;         rdfs(i, t);       }     }     for (int i = 0; i < n; i++) {       if (!vis[i]) printf( %d  , i + 1);     }     return 0;   }   