func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mxN = 1e6 + 5;   vector<int> adj[mxN];   int n, m, sz[mxN], dp[mxN], dpb[mxN], mn[mxN];   bool bad[mxN];   int ans = 1e9 + 7, V;   void dfs1(int v, int par = -1) {     sz[v] += bad[v];     for (auto to : adj[v]) {       if (par != to) {         dfs1(to, v);         sz[v] += sz[to];         if (sz[to]) {           dpb[v] += dpb[to] + 2;           mn[v] = min(mn[v], (dp[to] + 1) - (dpb[to] + 2));         }       }     }     dp[v] = dpb[v] + mn[v];   }   void dfs2(int v, int par = -1) {     if (dp[v] < ans)       ans = dp[v], V = v;     else if (dp[v] == ans)       V = min(V, v);     multiset<pair<int, int> > mt;     for (auto to : adj[v]) {       if (sz[to]) mt.insert({min(0, (dp[to] + 1) - (dpb[to] + 2)), to});     }     for (auto to : adj[v]) {       if (to != par) {         int dpB = dp[v], dpbB = dpb[v];         int mnB = mn[to];         int subdpB = dp[to], subdpbB = dpb[to];         dp[v] -= mt.begin()->first;         if (sz[to]) mt.erase({min(0, (dp[to] + 1) - (dpb[to] + 2)), to});         if (!mt.empty()) dp[v] += mt.begin()->first;         if (sz[to]) {           dp[v] -= dpb[to] + 2;           dpb[v] -= dpb[to] + 2;         }         sz[v] -= sz[to];         sz[to] += sz[v];         if (sz[v]) {           dpb[to] += dpb[v] + 2;           dp[to] += dpb[v] + 2;           if (mn[to] > (dp[v] + 1) - (dpb[v] + 2)) {             dp[to] -= mn[to];             mn[to] = (dp[v] + 1) - (dpb[v] + 2);             dp[to] += mn[to];           }         }         dfs2(to, v);         sz[to] -= sz[v];         sz[v] += sz[to];         dp[v] = dpB, dpb[v] = dpbB;         mn[to] = mnB;         dp[to] = subdpB, dpb[to] = subdpbB;         if (sz[to]) mt.insert({min(0, (dp[to] + 1) - (dpb[to] + 2)), to});       }     }   }   int main() {     ios ::sync_with_stdio(false), cin.tie(nullptr);     cin >> n >> m;     for (int i = 1; i < n; ++i) {       int u, v;       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     for (int i = 1; i <= m; ++i) {       int v;       cin >> v;       bad[v] = 1;     }     dfs1(1);     dfs2(1);     cout << V <<   n  << ans;     return 0;   }   