#include <bits/stdc++.h>   using namespace std;   int n;   int m;   struct st {     int dp;     int maxt;     int cnt;     bool use;     st() {       dp = maxt = cnt = 0;       use = false;     }   };   vector<st> dp[123457];   vector<int> v[123457];   vector<int> nex[123457];   bool oc[123457];   bool visited[123457];   pair<int, int> max1[123457];   pair<int, int> max2[123457];   int sum_cnt[123457];   int not_contain[123457];   int dpp[123457];   inline void dfs(int a, int b) {     if (dp[a][b].use) {       return;     }     dp[a][b].use = true;     if (visited[a]) {       dp[a][b].cnt = sum_cnt[a];       dp[a][b].dp = dpp[a];       dp[a][b].maxt = max1[a].first;       if (max1[a].second == b) {         dp[a][b].maxt = max2[a].first;       }       dp[a][b].use = true;       if (dp[v[a][b]][nex[a][b]].cnt) {         dp[a][b].dp -= dp[v[a][b]][nex[a][b]].dp + 2;         dp[a][b].cnt -= dp[v[a][b]][nex[a][b]].cnt;       }       dfs(v[a][not_contain[a]], nex[a][not_contain[a]]);       if (dp[v[a][not_contain[a]]][nex[a][not_contain[a]]].cnt) {         dp[a][b].dp += dp[v[a][not_contain[a]]][nex[a][not_contain[a]]].dp + 2;         dp[a][b].cnt += dp[v[a][not_contain[a]]][nex[a][not_contain[a]]].cnt;         dp[a][b].maxt =             max(dp[a][b].maxt,                 dp[v[a][not_contain[a]]][nex[a][not_contain[a]]].maxt + 1);       }       return;     }     visited[a] = true;     if (oc[a]) {       dp[a][b].cnt++;     }     int siz = v[a].size();     pair<int, int> MA1 = make_pair(0, -1);     pair<int, int> MA2 = make_pair(0, -1);     for (int i = 0; i < siz; i++) {       if (i == b) {         continue;       }       int l = v[a][i];       int r = nex[a][i];       if (!dp[l][r].use) {         dfs(l, r);       }       if (dp[l][r].cnt) {         dp[a][b].cnt += dp[l][r].cnt;         if (dp[l][r].maxt + 1 > dp[a][b].maxt) {           dp[a][b].maxt = dp[l][r].maxt + 1;         }         pair<int, int> ne = make_pair(dp[l][r].maxt + 1, i);         if (ne > MA1) {           MA2 = MA1;           MA1 = ne;         } else {           if (ne > MA2) {             MA2 = ne;           }         }         dp[a][b].dp += dp[l][r].dp + 2;       }     }     sum_cnt[a] = dp[a][b].cnt;     not_contain[a] = b;     max1[a] = MA1;     max2[a] = MA2;     dpp[a] = dp[a][b].dp;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i < n; i++) {       int a, b;       scanf( %d%d , &a, &b);       a--;       b--;       nex[a].push_back(v[b].size());       nex[b].push_back(v[a].size());       v[a].push_back(b);       v[b].push_back(a);     }     for (int i = 0; i < n; i++) {       dp[i].assign(v[i].size(), st());     }     for (int i = 0; i < m; i++) {       int a;       scanf( %d , &a);       a--;       oc[a] = true;     }     int ans = INT_MAX;     int ans_index = 0;     for (int i = 0; i < n; i++) {       int maxx = 0;       int sum = 0;       int siz = v[i].size();       for (int j = 0; j < siz; j++) {         int l = v[i][j];         int r = nex[i][j];         dfs(l, r);         if (dp[l][r].cnt) {           if (dp[l][r].maxt + 1 > maxx) {             maxx = dp[l][r].maxt + 1;           }           sum += dp[l][r].dp + 2;         }       }       sum -= maxx;       if (ans > sum) {         ans = sum;         ans_index = i;       }     }     printf( %d n , ans_index + 1);     printf( %d n , ans);     return 0;   }