#include <bits/stdc++.h>   using namespace std;   struct RTC {};   const int maxn = 123456 + 5;   int n;   int root;   bool humans[maxn];   vector<int> g_tmp[maxn], g[maxn];   ;   bool cut(int u, int p = -1) {     bool ret = humans[u];     for (int v : g_tmp[u]) {       if (v == p) continue;       if (cut(v, u)) {         ret = true;         g[u].push_back(v);       }     }     return ret;   }   int cnt[maxn];   int deep[maxn];   void count(int u) {     cnt[u] = 1;     deep[u] = 0;     for (int v : g[u]) {       count(v);       cnt[u] += cnt[v];       deep[u] = max(deep[u], 1 + deep[v]);     }   }   int maxlen = -1, id = -1;   void solve(int u, int up) {     if (humans[u]) {       int res = max(deep[u], up);       if (res > maxlen) {         maxlen = res;         id = u;       } else if (res == maxlen) {         id = min(id, u);       }     }     if (((int)(g[u]).size()) > 0) {       int down_v = 0;       for (int i = 1; i < ((int)(g[u]).size()); i++)         if (deep[g[u][i]] > deep[g[u][down_v]]) down_v = i;       if (up >= (deep[g[u][down_v]] + 1)) {         for (int v : g[u]) solve(v, up + 1);       } else {         for (int i = 0; i < (((int)(g[u]).size())); i++) {           if (i == down_v) continue;           solve(g[u][i], deep[g[u][down_v]] + 2);         }         int second_down_v = -1;         for (int i = 0; i < (((int)(g[u]).size())); i++) {           if (i == down_v) continue;           if (second_down_v == -1 || deep[g[u][i]] > deep[g[u][second_down_v]])             second_down_v = i;         }         if (second_down_v == -1 || up >= (deep[g[u][second_down_v]] + 1))           solve(g[u][down_v], up + 1);         else           solve(g[u][down_v], deep[g[u][second_down_v]] + 2);       }     }   }   int N;   int main() {     int m;     scanf( %d %d , &n, &m);     for (int i = 0; i < (n - 1); i++) {       int u, v;       scanf( %d %d , &u, &v);       g_tmp[u].push_back(v);       g_tmp[v].push_back(u);     }     while (m--) {       int u;       scanf( %d , &u);       humans[u] = true;       root = u;     }     cut(root);     count(root);     N = cnt[root];     solve(root, 0);     int arcos = N - 1;     printf( %d n%d n , id, 2 * arcos - maxlen);     return 0;   }   