func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5;   long long dp[N], f[N], ok[N], p[N];   vector<long long> node[N];   long long cur, now;   void dfs(long long u, long long p) {     for (auto j : node[u]) {       if (j == p) continue;       dfs(j, u);       if (f[j]) {         dp[u] += dp[j] + 1;         f[u] = 1;       }     }     if (ok[u]) f[u] = 1;   }   void find_dia(long long u, long long p, long long dis) {     if (dis >= cur && ok[u]) {       if (dis > cur)         now = u;       else         now = min(now, u);       cur = dis;     }     for (auto j : node[u]) {       if (j == p) continue;       find_dia(j, u, dis + 1);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     if (fopen( A.INP ,  r )) {       freopen( A.INP ,  r , stdin);       freopen( A.OUT ,  w , stdout);     }     long long n, m;     cin >> n >> m;     for (int i = 1; i < n; i++) {       long long u, v;       cin >> u >> v;       node[u].push_back(v);       node[v].push_back(u);     }     for (int i = 1; i <= m; i++) cin >> p[i], ok[p[i]] = 1;     dfs(p[1], p[1]);     long long ans = dp[p[1]] * 2;     cur = 0;     now = 1e9;     find_dia(p[1], p[1], 0);     cur = 0;     long long f = now;     now = 1e9;     find_dia(f, f, 0);     cout << min(f, now) <<   n ;     cout << ans - cur;   }   