func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const int N = 1e6 + 5;   inline int readint() {     char c = getchar();     int ans = 0;     while (c <  0  || c >  9 ) {       c = getchar();     }     while (c >=  0  && c <=  9 ) {       ans = ans * 10 + c -  0 , c = getchar();     }     return ans;   }   vector<int> tree[N];   bool check[N];   int father[N][21];   int deep[N];   void dfs(int x, int level) {     for (int i = 0; father[father[x][i]][i]; i++) {       father[x][i + 1] = father[father[x][i]][i];     }     deep[x] = level;     for (int i = 0; i < tree[x].size(); i++) {       int to = tree[x][i];       if (to == father[x][0]) {         continue;       }       father[to][0] = x;       dfs(to, level + 1);     }   }   int main() {     int n, k;     n = readint(), k = readint();     int u, v;     for (int i = 1; i < n; i++) {       u = readint(), v = readint();       tree[u].push_back(v);       tree[v].push_back(u);     }     k = n - k;     k--, check[n] = 1;     dfs(n, 1);     for (int i = n - 1; i >= 1 && k; i--) {       int aim = -1;       int now = i;       if (check[i]) {         continue;       }       for (int j = 20; j >= 0; j--) {         if (father[now][j] == 0 || check[father[now][j]]) {           continue;         }         now = father[now][j];       }       if (deep[i] - deep[now] + 1 <= k) {         now = i;         while (now != 0 && !check[now]) {           check[now] = 1;           k--;           now = father[now][0];         }       }     }     for (int i = 1; i <= n - 1; i++) {       if (!check[i]) {         cout << i <<    ;       }     }     return 0;   }   