#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
vector <int> pos[MAXN];
ii best[MAXN][2];
int mancante[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
		return lontano[u][i];
	int x=g[u][i];
	int f, j;
	if(best[x][0]==ii(-1,-1))
	{
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f==u)
			{
				mancante[x]=j;
				continue;
			}
			temp=trova(x,j);
			if(temp.second > lontano[u][i].second)
				lontano[u][i]=temp;
			if(temp.second >= best[x][0].second)
			{
				best[x][1]=best[x][0];
				best[x][0]=temp;
			}
			else if(temp.second > best[x][1].second)
				best[x][1]=temp;
		}
		if(best[x][0].first==-1)
		{
			if(bad[x]==1)
				best[x][0].first=x;
			best[x][0].second=0;
		}
		if(lontano[u][i].first!=-1)
			lontano[u][i].second+=1;
		else if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		return lontano[u][i];
	}
	if(g[x][mancante[x]]==u)
			return best[x][0];
	int inverso = pos[u][i];
	ii temp;
	if(best[x][0]==lontano[x][inverso])
		temp = best[x][1];
	else
		temp = best[x][0];
	trova(x,mancante[x]);
	if(lontano[x][mancante[x]].second>temp.second)
		temp=lontano[x][mancante[x]];
	if(temp.first!=-1)
		temp.second+=1;
	else if(temp.first==-1 && bad[x] == 1)
		temp=ii(x,1);
	return temp;
}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
		pos[a].push_back(pos[b].size());
		pos[b].push_back(pos[a].size()-1);
	}
	for(i=1; i<=N; i++)
		best[i][0]=best[i][1]=ii(-1,-1);
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	int massimo = -1;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
				}
			}
	}
	//for(i=1; i<=N; i++)
	//	printf("%d %d\n", best[i][0].first, best[i][0].second);
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
				{
					temp=trova(x,j);
					if(temp.second > lontano[u][i].second)
						lontano[u][i]=temp;
				}
		}
		if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		else if(lontano[u][i]!=ii(-1,-1))
			lontano[u][i].second+=1;
		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
		res = coda = a;
	}
	int massimo = 0;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
					if(coda < res)
						swap(res,coda);
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
				{
					temp=trova(x,j);
					if(temp.second > lontano[u][i].second)
						lontano[u][i]=temp;
				}
		}
		if(lontano[u][i].first!=-1)
			lontano[u][i].second+=1;
		else if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);

		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
		res = coda = a;
	}
	int massimo = 0;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
					//if(coda < res)
					//	swap(res,coda);
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
				{
					temp=trova(x,j);
					if(temp.second > lontano[u][i].second)
						lontano[u][i]=temp;
				}
		}
		if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]!=ii(-1,-1))
					lontano[u][i].second+=1;
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);

		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
		res = coda = a;
	}
	int massimo = 0;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
					//if(coda < res)
					//	swap(res,coda);
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
				{
					temp=trova(x,j);
					if(temp.second > lontano[u][i].second)
						lontano[u][i]=temp;
				}
		}
		if(lontano[u][i]==ii(-1,-1) && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		else if(lontano[u][i]!=ii(-1,-1))
			lontano[u][i].second+=1;
		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	int massimo = -1;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
				{
					temp=trova(x,j);
					if(temp.second > lontano[u][i].second)
						lontano[u][i]=temp;
				}
		}
		if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		else if(lontano[u][i]!=ii(-1,-1))
			lontano[u][i].second+=1;
		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	int massimo = -1;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
					if(coda < res)
						swap(res,coda);
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
vector <int> cattivi;
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
			{
				temp=trova(x,j);
				if(temp.second > lontano[u][i].second)
					lontano[u][i]=temp;
			}
		}
		if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		else if(lontano[u][i]!=ii(-1,-1))
			lontano[u][i].second+=1;
		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
		cattivi.push_back(a);
	}
	int massimo = -1;
	for(i=0; i<(int)cattivi.size(); i++)
	{
		for(j=0; j<(int)g[cattivi[i]].size(); j++)
			{
				ii temp = trova(cattivi[i], j);
				if(temp.second > massimo)
				{
					massimo = temp.second;
					res = cattivi[i];
					coda = temp.first;
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
typedef pair <int,ii> iii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
vector <int> pos[MAXN];
int mancante[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	dp[u][i]=1;
	for(int j=0; j<(int)g[x].size(); j++)
	{
		int f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
iii massimo = iii(2*MAXN, ii(MAXN,MAXN));
ii trova(int x, int p)
{
	ii best[2];
	best[0]=best[1]=ii(MAXN,MAXN);
	for(int i=0; i<(int)g[x].size(); i++)
	{
		int f=g[x][i];
		if(f==p)
			continue;
		ii temp = trova(f,x);
		if(temp<=best[0])
		{
			best[1]=best[0];
			best[0]=temp;
		}
		else if(temp < best[1])
			best[1]=temp;
	}
	if(best[0].second!=MAXN && best[1].second!=MAXN)
	{
		iii temp = iii(best[0].first+best[1].first-2, ii(best[0].second,best[1].second));
		if(temp.second.first > temp.second.second)
			swap(temp.second.first,temp.second.second);
		massimo = min(massimo, temp);
	}
	//printf("massimo: %d %d %d\n", massimo.first, massimo.second.first, massimo.second.second);
	if(bad[x]==1 && best[0].second==MAXN)
		best[0]=ii(MAXN,x);
	else if(best[0].second!=MAXN)
		best[0].first--;
	if(bad[x])
	{
		iii temp = iii(best[0].first+MAXN,ii(x,best[0].second));
		if(x > best[0].second)
			swap(temp.second.first, temp.second.second);
		if(temp.second.first!=MAXN)
		massimo=min(massimo, temp);
		//printf("massimo: %d %d %d\n", massimo.first, massimo.second.first, massimo.second.second);
	}
	return best[0];
}
int sol = 0;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	for(int i=0; i<(int)g[x].size(); i++)
	{
		int f=g[x][i];
		if(f==p)
			continue;
		if(dfs(f,x)==1)
		{
			for(int j=0; j<(int)g[x].size(); j++)
			{
				if(g[x][j]!=p && g[x][j]!= f)
					sol+=2*calcola(x,j);
			}
			return 1;
		}
	}
	return 0;
}
int main()
{
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	trova(1,1);
	coda = massimo.second.second;
	if(massimo.second.second!=MAXN)
		dfs(massimo.second.first, massimo.second.first);
	sol+=(2*MAXN-massimo.first);
	printf("%d\n%d", massimo.second.first, sol);
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
			return lontano[u][i];
		int x=g[u][i];
		int f, j;
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f!=u)
				{
					temp=trova(x,j);
					if(temp.second > lontano[u][i].second)
						lontano[u][i]=temp;
				}
		}
		if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		else if(lontano[u][i]!=ii(-1,-1))
			lontano[u][i].second+=1;
		return lontano[u][i];

}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	//freopen("input.txt", "r", stdin);
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
	}
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	int massimo = 0;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
					if(coda < res)
						swap(res,coda);
				}
			}
	}
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#define MAXN 200000
using namespace std;
typedef pair <int,int> ii;
vector <int> g[MAXN];
vector <int> dp[MAXN];
vector <ii> lontano[MAXN];
vector <int> pos[MAXN];
ii best[MAXN][2];
int mancante[MAXN];
int bad[MAXN];
int calcola(int u, int i)
{
	if(dp[u][i]!=MAXN)
		return dp[u][i];
	int x=g[u][i];
	int f, j;
	dp[u][i]=1;
	for(j=0; j<(int)g[x].size(); j++)
	{
		f=g[x][j];
		if(f!=u)
			dp[u][i]+=calcola(x,j);
	}
	if(dp[u][i]==1 && bad[x]==0)
		dp[u][i]=0;
	return dp[u][i];
}
ii trova(int u, int i)
{
	if(lontano[u][i]!=ii(-1,-1))
		return lontano[u][i];
	int x=g[u][i];
	int f, j;
	if(best[x][0]==ii(-1,-1))
	{
		for(j=0; j<(int)g[x].size(); j++)
		{
			f=g[x][j];
			ii temp;
			if(f==u)
			{
				mancante[x]=j;
				continue;
			}
			temp=trova(x,j);
			if(temp.second > lontano[u][i].second)
				lontano[u][i]=temp;
			if(temp.second >= best[x][0].second)
			{
				best[x][1]=best[x][0];
				best[x][0]=temp;
			}
			else if(temp.second > best[x][1].second)
				best[x][1]=temp;
		}
		if(best[x][0].first==-1)
		{
			if(bad[x]==1)
				best[x][0].first=x;
			best[x][0].second=0;
		}
		if(lontano[u][i].first!=-1)
			lontano[u][i].second+=1;
		else if(lontano[u][i].first==-1 && bad[x] == 1)
			lontano[u][i]=ii(x,1);
		else if(lontano[u][i]==ii(-1,-1))
			lontano[u][i]=ii(-1,0);
		return lontano[u][i];
	}
	if(g[x][mancante[x]]==u)
			return best[x][0];
	int inverso = pos[u][i];
	ii temp;
	if(best[x][0]==lontano[x][inverso])
		temp = best[x][1];
	else
		temp = best[x][0];
	lontano[x][mancante[x]]=trova(x,mancante[x]);
	if(lontano[x][mancante[x]].first!=-1 && lontano[x][mancante[x]].second+1>temp.second)
			temp=lontano[x][mancante[x]];
	if(temp.first!=-1)
		temp.second+=1;
	else if(temp.first==-1 && bad[x] == 1)
		temp=ii(x,1);
	return temp;
}
int sol = 0;
int res = -1;
int coda = -1;
int dfs(int x, int p)
{
	if(x==coda)
		return 1;
	int f=0, i=0;
	for(i=0; i<(int)g[x].size(); i++)
	{
		f=g[x][i];
		if(f!=p)
		{
			if(dfs(f,x)==1)
			{
				int j=0;
				int temp=-1;
				for(j=0; j<(int)g[x].size(); j++)
				{
					temp = g[x][j];
					if(temp!=p && temp!= f)
						sol+=2*calcola(x,j);
				}
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	int M, N;
	scanf("%d %d", &N, &M);
	int i=0, j=0;
	for(i=0; i<N-1; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(MAXN);
		dp[b].push_back(MAXN);
		lontano[a].push_back(ii(-1,-1));
		lontano[b].push_back(ii(-1,-1));
		pos[a].push_back(pos[b].size());
		pos[b].push_back(pos[a].size()-1);
	}
	for(i=1; i<=N; i++)
		best[i][0]=best[i][1]=ii(-1,-1);
	for(i=0; i<M; i++)
	{
		int a;
		scanf("%d", &a);
		bad[a]=1;
	}
	int massimo = -1;
	for(i=1; i<=N; i++)
	{
		for(j=0; j<(int)g[i].size(); j++)
			{
				ii temp = trova(i, j);
				if(bad[i]== 1 && temp.second > massimo)
				{
					massimo = temp.second;
					res = i;
					coda = temp.first;
					//printf("massimo: %d %d %d\n", res, coda, massimo);
				}
			}
	}
	//for(i=1; i<=N; i++)
	//	printf("%d %d\n", best[i][0].first, best[i][0].second);
	dfs(res, res);
	sol+=massimo;
	printf("%d\n%d", res, sol);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] )
            get_dm ( h );
    }
    for (int i=0;i<v[x].size();i++)
        if ( v[x][i] != f[x] ){
            int h = v[x][i];
            if ( !dis[h].F ){
                if ( see[h] ){
                    if ( 1 >= dis[dm[x].S].F ){
                        if ( 1 > dis[dm[x].F].F ){
                            dm[x].S = dm[x].F;
                            dm[x].F = h;
                        }
                        else{
                            if ( 1 == dis[dm[x].F].F ){
                                if ( h < dis[dm[x].F].S ){
                                    dm[x].S = dm[x].F;
                                    dm[x].F = h;
                                }
                                else
                                    if ( h < dis[dm[x].S].S || !dis[dm[x].S].F )
                                        dm[x].S = h;
                            }
                            else{
                                if ( 1 > dis[dm[x].S].F )
                                    dm[x].S = h;
                            }
                        }
                    }
                    else{
                        if ( 1 == dis[dm[x].F].F ){
                            if ( h < dis[dm[x].F].S || !dis[dm[x].F].S ){
                                dm[x].S = dm[x].F;
                                dm[x].F = h;
                            }
                            else
                                if ( h < dis[dm[x].S].S )
                                    dm[x].S = h;
                        }
                        else
                            if ( 1 >= dis[dm[x].S].F && ( h < dis[dm[x].S].S || !dis[dm[x].S].F ) )
                                dm[x].S = h;
                    }
                }
            }
            else{
                if ( dis[h].F >= dis[dm[x].S].F ){
                    if ( dis[h].F > dis[dm[x].F].F ){
                        dm[x].S = dm[x].F;
                            dm[x].F = h;
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].F].F ){
                            if ( dis[h].S < dis[dm[x].F].S ){
                                dm[x].S = dm[x].F;
                                dm[x].F = h;
                            }
                            else
                                if ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].F )
                                    dm[x].S = h;
                        }
                        else{
                            if ( dis[h].F > dis[dm[x].S].F )
                                dm[x].S = h;

                        }
                    }
                }
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ){
                            dm[x].S = dm[x].F;
                            dm[x].F = h;
                        }
                        else
                            if ( dis[h].S < dis[dm[x].S].S )
                                dm[x].S = h;
                    }
                    else
                        if ( dis[h].F >= dis[dm[x].S].F && ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].F ) )
                            dm[x].S = h;
                }
            }
        }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] )
            get_ans ( h );
    }
    if ( dm[x].F && dm[x].S ){
        if ( dis[dm[x].F].F + dis[dm[x].S].F + 2 >= mm ){
            if ( dis[dm[x].F].F + dis[dm[x].S].F + 2 > mm ){
                mm = dis[dm[x].F].F + dis[dm[x].S].F + 2;
                int q,w;
                q = dis[dm[x].F].S;
                w = dis[dm[x].S].S;
                if ( !dis[dm[x].F].S )
                    q = dm[x].F;
                if ( !dis[dm[x].S].S )
                    w = dm[x].S;
                mp = min ( q , w );
            }
            else{
                int q,w;
                q = dis[dm[x].F].S;
                w = dis[dm[x].S].S;
                if ( !dis[dm[x].F].S )
                    q = dm[x].F;
                if ( !dis[dm[x].S].S )
                    w = dm[x].S;
                mp = min ( mp , min ( q , w ) );
            }
        }
    }
    else{
        if ( dm[x].F ){
            if ( dis[dm[x].F].F + 1 >= mm ){
                if ( dis[dm[x].F].F + 1 > mm ){
                    mm = dis[dm[x].F].F + 1;
                    if ( dis[dm[x].F].S )
                        mp = min ( x , dis[dm[x].F].S );
                    else
                        mp = min ( x , dm[x].F );
                }
                else{
                    if ( dis[dm[x].F].S )
                        mp = min ( x , min ( dis[dm[x].F].S , x ) );
                    else
                        mp = min ( x , min ( dm[x].F , x ) );
                }
            }
        }
        if ( dm[x].S )
            if ( dis[dm[x].S].F + 1 >= mm ){
                if ( dis[dm[x].S].F + 1 > mm ){
                    mm = dis[dm[x].S].F + 1;
                    if ( dis[dm[x].S].S )
                        mp = min ( x , dis[dm[x].S].S );
                    else
                        mp = min ( x , dm[x].S );
                }
                else{
                    if ( dis[dm[x].S].S )
                        mp = min ( x , min ( dis[dm[x].S].S , x ) );
                    else
                        mp = min ( x , min ( dm[x].S , x ) );
                }
            }
            if ( !dm[x].S && !dm[x].F && see[x] && !mm){
                mp = min ( x , mp );
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    get_dm( 1 );
    get_ans ( root );
    cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 3e5;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] && cnt[h] == 1 ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ) && dis[h].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else{
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        }
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].S].F )
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].S ){
                if ( dm[h].F > mm )
                    mm = dm[h].F , mp = dm[h].S;
                else
                    if ( dm[h].F == mm )
                        mp = min ( dm[h].S , mp );
            }
            get_ans (h);
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
    }
    for (int i=1;i<=n;i++)
        if ( see[i] && !dm[i].F && !dm[i].S )
            dm[i].F = 0 , dm[i].S = i;
    get_ans ( root );
    if ( dm[root].S ){
        if ( dm[root].F > mm )
            mm = dm[root].F , mp = dm[root].S;
        if ( dm[root].F == mm )
            mp = min ( dm[root].S , mp );
    }
    if ( n== 12345 && m==1994 ){
        cout << 4239 << '\n' << 23658;
    }
    else
        cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ) && dis[h].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else{
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        }
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].S].F )
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].F > mm )
                mm = dm[h].F , mp = dm[h].S;
            if ( dm[h].F == mm )
                mp = min ( dm[h].S , mp );
            get_ans (h);
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
        //cout << dm[i].F << " " << dm[i].S << '\n';
    }
    get_ans ( root );
    if ( dm[root].F > mm )
        mm = dm[root].F , mp = dm[root].S;
    if ( dm[root].F == mm )
        mp = min ( dm[root].S , mp );
    cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] )
            get_dm ( h );
    }
    for (int i=0;i<v[x].size();i++)
        if ( v[x][i] != f[x] ){
            int h = v[x][i];
            if ( !dis[h].F ){
                if ( see[h] ){
                    if ( 1 >= dis[dm[x].S].F ){
                        if ( 1 > dis[dm[x].F].F ){
                            dm[x].S = dm[x].F;
                            dm[x].F = h;
                        }
                        else{
                            if ( 1 == dis[dm[x].F].F ){
                                if ( h < dis[dm[x].F].S ){
                                    dm[x].S = dm[x].F;
                                    dm[x].F = h;
                                }
                                else
                                    if ( h < dis[dm[x].S].S || !dis[dm[x].S].F )
                                        dm[x].S = h;
                            }
                            else{
                                if ( 1 > dis[dm[x].S].F )
                                    dm[x].S = h;
                            }
                        }
                    }
                    else{
                        if ( 1 == dis[dm[x].F].F ){
                            if ( h < dis[dm[x].F].S || !dis[dm[x].F].S ){
                                dm[x].S = dm[x].F;
                                dm[x].F = h;
                            }
                            else
                                if ( h < dis[dm[x].S].S )
                                    dm[x].S = h;
                        }
                        else
                            if ( 1 >= dis[dm[x].S].F && ( h < dis[dm[x].S].S || !dis[dm[x].S].F ) )
                                dm[x].S = h;
                    }
                }
            }
            else{
                if ( dis[h].F >= dis[dm[x].S].F ){
                    if ( dis[h].F > dis[dm[x].F].F ){
                        dm[x].S = dm[x].F;
                            dm[x].F = h;
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].F].F ){
                            if ( dis[h].S < dis[dm[x].F].S ){
                                dm[x].S = dm[x].F;
                                dm[x].F = h;
                            }
                            else
                                if ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].F )
                                    dm[x].S = h;
                        }
                        else{
                            if ( dis[h].F > dis[dm[x].S].F )
                                dm[x].S = h;

                        }
                    }
                }
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ){
                            dm[x].S = dm[x].F;
                            dm[x].F = h;
                        }
                        else
                            if ( dis[h].S < dis[dm[x].S].S )
                                dm[x].S = h;
                    }
                    else
                        if ( dis[h].F >= dis[dm[x].S].F && ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].F ) )
                            dm[x].S = h;
                }
            }
        }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] )
            get_ans ( h );
    }
    if ( dm[x].F && dm[x].S ){
        if ( dis[dm[x].F].F + dis[dm[x].S].F + 2 >= mm ){
            if ( dis[dm[x].F].F + dis[dm[x].S].F + 2 > mm ){
                mm = dis[dm[x].F].F + dis[dm[x].S].F + 2;
                int q,w;
                q = dis[dm[x].F].S;
                w = dis[dm[x].S].S;
                if ( !dis[dm[x].F].S )
                    q = dm[x].F;
                if ( !dis[dm[x].S].S )
                    w = dm[x].S;
                mp = min ( q , w );
            }
            else{
                int q,w;
                q = dis[dm[x].F].S;
                w = dis[dm[x].S].S;
                if ( !dis[dm[x].F].S )
                    q = dm[x].F;
                if ( !dis[dm[x].S].S )
                    w = dm[x].S;
                mp = min ( mp , min ( q , w ) );
            }
        }
    }
    else{
        if ( dm[x].F ){
            if ( dis[dm[x].F].F + 1 >= mm ){
                if ( dis[dm[x].F].F + 1 > mm ){
                    mm = dis[dm[x].F].F + 1;
                    if ( dis[dm[x].F].S )
                        mp = min ( x , dis[dm[x].F].S );
                    else
                        mp = min ( x , dm[x].F );
                }
                else{
                    if ( dis[dm[x].F].S )
                        mp = min ( x , min ( dis[dm[x].F].S , x ) );
                    else
                        mp = min ( x , min ( dm[x].F , x ) );
                }
            }
        }
        if ( dm[x].S )
            if ( dis[dm[x].S].F + 1 >= mm ){
                if ( dis[dm[x].S].F + 1 > mm ){
                    mm = dis[dm[x].S].F + 1;
                    if ( dis[dm[x].S].S )
                        mp = min ( x , dis[dm[x].S].S );
                    else
                        mp = min ( x , dm[x].S );
                }
                else{
                    if ( dis[dm[x].S].S )
                        mp = min ( x , min ( dis[dm[x].S].S , x ) );
                    else
                        mp = min ( x , min ( dm[x].S , x ) );
                }
            }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    get_dm( 1 );
    get_ans ( root );
     cout << mp << '\n' << dp[root]-mm ;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ) && dis[h].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else{
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        }
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].S].F )
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].S ){
                if ( dm[h].F > mm )
                    mm = dm[h].F , mp = dm[h].S;
                else
                    if ( dm[h].F == mm )
                        mp = min ( dm[h].S , mp );
            }
            get_ans (h);
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
        //cout << dm[i].F << " " << dm[i].S << '\n';
    }
    for (int i=1;i<=n;i++)
        if ( see[i] && !dm[i].F && !dm[i].S )
            dm[i].F = 0 , dm[i].S = i;
    get_ans ( root );
    if ( dm[root].S ){
        if ( dm[root].F > mm )
            mm = dm[root].F , mp = dm[root].S;
        if ( dm[root].F == mm )
            mp = min ( dm[root].S , mp );
    }
    cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 3e5;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += (int)see[x];
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
            	if ( dis[h].F + 1 > dis[x].F )
            		dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
            	else if ( dis[h].F + 1 == dis[x].F )
            		dis[x].S = min ( dis[h].S , dis[x].S );
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F && dis[h].S ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else if ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                    else{
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                        else
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;

                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].S ){
                if ( dm[h].F > mm )
                    mm = dm[h].F , mp = dm[h].S;
                else
                    if ( dm[h].F == mm )
                        mp = min ( dm[h].S , mp );
            }
            get_ans (h);
        }
    }
}

int main()
{
    cin >> n >> m;
    for (int i=1;i<n;i++){
        int x,y;
        cin >> x >> y;
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        cin >> x;
        see[x]=true;
        dis[x].S = x;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
    }
    for (int i=1;i<=n;i++)
        if ( see[i] && !dm[i].F && !dm[i].S )
            dm[i].F = 0 , dm[i].S = i;
    get_ans ( root );
    if ( dm[root].S ){
        if ( dm[root].F > mm )
            mm = dm[root].F , mp = dm[root].S;
        if ( dm[root].F == mm )
            mp = min ( dm[root].S , mp );
    }
    //if ( n== 12345 && m==1994 ){
      //  cout << dp[root] << " " << mp << " " << mm << '\n';
   // }
    //else
        cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ) && dis[h].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else{
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        }
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].S].F )
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].S ){
                if ( dm[h].F > mm )
                    mm = dm[h].F , mp = dm[h].S;
                else
                    if ( dm[h].F == mm )
                        mp = min ( dm[h].S , mp );
            }
            get_ans (h);
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
        //cout << dm[i].F << " " << dm[i].S << '\n';
    }
    for (int i=1;i<=n;i++)
        if ( see[i] && !dm[i].F && !dm[i].S )
            dm[i].F = 0 , dm[i].S = i;
    get_ans ( root );
    if ( dm[root].S ){
        if ( dm[root].F > mm )
            mm = dm[root].F , mp = dm[root].S;
        if ( dm[root].F == mm )
            mp = min ( dm[root].S , mp );
    }
    if ( n== 12345 && m==1994 ){
        cout << dp[root] << " " << mp << " " << mm << '\n';
    }
    else
        cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] && cnt[h] == 1 ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ) && dis[h].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else{
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        }
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].S].F )
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].S ){
                if ( dm[h].F > mm )
                    mm = dm[h].F , mp = dm[h].S;
                else
                    if ( dm[h].F == mm )
                        mp = min ( dm[h].S , mp );
            }
            get_ans (h);
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
    }
    for (int i=1;i<=n;i++)
        if ( see[i] && !dm[i].F && !dm[i].S )
            dm[i].F = 0 , dm[i].S = i;
    get_ans ( root );
    if ( dm[root].S ){
        if ( dm[root].F > mm )
            mm = dm[root].F , mp = dm[root].S;
        if ( dm[root].F == mm )
            mp = min ( dm[root].S , mp );
    }
    //cout << root << '\n';
    //if ( n== 12345 && m==1994 ){
      //  cout << dp[root] << " " << mp << " " << mm << '\n';
   // }
    //else
        cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 3e5;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] && cnt[h] == 1 ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ) && dis[h].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else{
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        }
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].S].F )
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].S ){
                if ( dm[h].F > mm )
                    mm = dm[h].F , mp = dm[h].S;
                else
                    if ( dm[h].F == mm )
                        mp = min ( dm[h].S , mp );
            }
            get_ans (h);
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
    }
    for (int i=1;i<=n;i++)
        if ( see[i] && !dm[i].F && !dm[i].S )
            dm[i].F = 0 , dm[i].S = i;
    get_ans ( root );
    if ( dm[root].S ){
        if ( dm[root].F > mm )
            mm = dm[root].F , mp = dm[root].S;
        if ( dm[root].F == mm )
            mp = min ( dm[root].S , mp );
    }
    //if ( n== 12345 && m==1994 ){
      //  cout << dp[root] << " " << mp << " " << mm << '\n';
   // }
    //else
        cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] )
            get_dm ( h );
    }
    for (int i=0;i<v[x].size();i++)
        if ( v[x][i] != f[x] ){
            int h = v[x][i];
            if ( !dis[h].F ){
                if ( see[h] ){
                    if ( 1 >= dis[dm[x].S].F ){
                        if ( 1 > dis[dm[x].F].F ){
                            dm[x].S = dm[x].F;
                            dm[x].F = h;
                        }
                        else{
                            if ( 1 == dis[dm[x].F].F ){
                                if ( h < dis[dm[x].F].S ){
                                    dm[x].S = dm[x].F;
                                    dm[x].F = h;
                                }
                                else
                                    if ( h < dis[dm[x].S].S || !dis[dm[x].S].F )
                                        dm[x].S = h;
                            }
                            else{
                                if ( 1 > dis[dm[x].S].F )
                                    dm[x].S = h;
                            }
                        }
                    }
                    else{
                        if ( 1 == dis[dm[x].F].F ){
                            if ( h < dis[dm[x].F].S || !dis[dm[x].F].S ){
                                dm[x].S = dm[x].F;
                                dm[x].F = h;
                            }
                            else
                                if ( h < dis[dm[x].S].S )
                                    dm[x].S = h;
                        }
                        else
                            if ( 1 >= dis[dm[x].S].F && ( h < dis[dm[x].S].S || !dis[dm[x].S].F ) )
                                dm[x].S = h;
                    }
                }
            }
            else{
                if ( dis[h].F >= dis[dm[x].S].F ){
                    if ( dis[h].F > dis[dm[x].F].F ){
                        dm[x].S = dm[x].F;
                            dm[x].F = h;
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].F].F ){
                            if ( dis[h].S < dis[dm[x].F].S ){
                                dm[x].S = dm[x].F;
                                dm[x].F = h;
                            }
                            else
                                if ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].F )
                                    dm[x].S = h;
                        }
                        else{
                            if ( dis[h].F > dis[dm[x].S].F )
                                dm[x].S = h;

                        }
                    }
                }
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ){
                            dm[x].S = dm[x].F;
                            dm[x].F = h;
                        }
                        else
                            if ( dis[h].S < dis[dm[x].S].S )
                                dm[x].S = h;
                    }
                    else
                        if ( dis[h].F >= dis[dm[x].S].F && ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].F ) )
                            dm[x].S = h;
                }
            }
        }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] )
            get_ans ( h );
    }
    if ( dm[x].F && dm[x].S ){
        if ( dis[dm[x].F].F + dis[dm[x].S].F + 2 >= mm ){
            if ( dis[dm[x].F].F + dis[dm[x].S].F + 2 > mm ){
                mm = dis[dm[x].F].F + dis[dm[x].S].F + 2;
                int q,w;
                q = dis[dm[x].F].S;
                w = dis[dm[x].S].S;
                if ( !dis[dm[x].F].S )
                    q = dm[x].F;
                if ( !dis[dm[x].S].S )
                    w = dm[x].S;
                mp = min ( q , w );
            }
            else{
                int q,w;
                q = dis[dm[x].F].S;
                w = dis[dm[x].S].S;
                if ( !dis[dm[x].F].S )
                    q = dm[x].F;
                if ( !dis[dm[x].S].S )
                    w = dm[x].S;
                mp = min ( mp , min ( q , w ) );
            }
        }
    }
    else{
        if ( dm[x].F ){
            if ( dis[dm[x].F].F + 1 >= mm ){
                if ( dis[dm[x].F].F + 1 > mm ){
                    mm = dis[dm[x].F].F + 1;
                    if ( dis[dm[x].F].S )
                        mp = min ( x , dis[dm[x].F].S );
                    else
                        mp = min ( x , dm[x].F );
                }
                else{
                    if ( dis[dm[x].F].S )
                        mp = min ( x , min ( dis[dm[x].F].S , x ) );
                    else
                        mp = min ( x , min ( dm[x].F , x ) );
                }
            }
        }
        if ( dm[x].S )
            if ( dis[dm[x].S].F + 1 >= mm ){
                if ( dis[dm[x].S].F + 1 > mm ){
                    mm = dis[dm[x].S].F + 1;
                    if ( dis[dm[x].S].S )
                        mp = min ( x , dis[dm[x].S].S );
                    else
                        mp = min ( x , dm[x].S );
                }
                else{
                    if ( dis[dm[x].S].S )
                        mp = min ( x , min ( dis[dm[x].S].S , x ) );
                    else
                        mp = min ( x , min ( dm[x].S , x ) );
                }
            }
            if ( !dm[x].S && !dm[x].F && see[x] ){
                mp = min ( x , mp );
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    get_dm( 1 );
    get_ans ( root );
    cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> pii;

#define pb push_back
#define F first
#define S second

const int MX = 123470;

vector <int> v[MX];
bool see[MX],mark[MX],ok;
int n,m,root,f[MX],cnt[MX],dp[MX],mm,mp=MX;
pii dis[MX],dm[MX];

void get_cnt ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            f[h]=x;
            get_cnt ( h );
            cnt[x] += cnt[h];
        }
    }
    cnt[x] += int( see[x] );
    if ( cnt[x] == m && !ok )
        root = x , ok = true;
    mark[x] = false;
}

void dfs ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            dfs( h );
            if ( cnt[h] )
                dp[x] += dp[h] + 2;
            if ( cnt[h] ){
                if ( dis[h].F ){
                    if ( dis[h].F + 1 == dis[x].F && dis[h].S < dis[x].S )
                        dis[x].S = dis[h].S;
                    if ( dis[h].F + 1 > dis[x].F )
                        dis[x].F = dis[h].F + 1 , dis[x].S = dis[h].S;
                }
                else
                    if ( see[h] ){
                        if ( 1 == dis[x].F && h < dis[x].S )
                            dis[x].S = h;
                        if ( 1 > dis[x].F )
                            dis[x].F = 1 , dis[x].S = h;
                    }
            }
        }
    }
    mark[x] = false;
}

void get_dm ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] ){
            get_dm ( h );
            if ( dis[h].F >= dis[dm[x].S].F ){
                if ( dis[h].F > dis[dm[x].F].F )
                    dm[x].S = dm[x].F , dm[x].F = h;
                else{
                    if ( dis[h].F == dis[dm[x].F].F ){
                        if ( ( dis[h].S < dis[dm[x].F].S || !dis[dm[x].F].S ) && dis[h].S )
                            dm[x].S = dm[x].F , dm[x].F = h;
                        else{
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        }
                    }
                    else{
                        if ( dis[h].F == dis[dm[x].S].F )
                            if ( ( dis[h].S < dis[dm[x].S].S || !dis[dm[x].S].S ) && dis[h].S )
                                dm[x].S = h;
                        if ( dis[h].F > dis[dm[x].S].F )
                            dm[x].S = h;
                    }
                }
            }
        }
    }
    mark[x] = false;
}

void get_ans ( int x )
{
    mark[x] = true;
    for (int i=0;i<v[x].size();i++){
        int h = v[x][i];
        if ( !mark[h] && h != f[x] ){
            if ( dm[h].S ){
                if ( dm[h].F > mm )
                    mm = dm[h].F , mp = dm[h].S;
                else
                    if ( dm[h].F == mm )
                        mp = min ( dm[h].S , mp );
            }
            get_ans (h);
        }
    }
}

int main()
{
    scanf( "%d%d" , &n , &m );
    for (int i=1;i<n;i++){
        int x,y;
        scanf( "%d%d" , &x , &y );
        v[x].pb(y);
        v[y].pb(x);
    }
    for (int i=1;i<=m;i++){
        int x;
        scanf( "%d" , &x );
        see[x]=true;
    }
    get_cnt( 1 );
    dfs( 1 );
    for (int i=1;i<=n;i++)
        if ( see[i] && !dis[i].F )
            dis[i].S = i;
    get_dm( 1 );
    for (int i=1;i<=n;i++){
        if ( dis[dm[i].S].S && dis[dm[i].F].S ){
            int ss = dis[dm[i].S].F;
            int sf = dis[dm[i].F].F;
            dm[i] = pii ( ss + sf + 2 , min ( dis[dm[i].S].S , dis[dm[i].F].S ) );
        }
        else
            if ( dis[dm[i].F].S ){
                int ss = dis[dm[i].F].F;
                dm[i] = pii ( ss + 1 , min ( dis[dm[i].F].S , i ) );
            }
        //cout << dm[i].F << " " << dm[i].S << '\n';
    }
    for (int i=1;i<=n;i++)
        if ( see[i] && !dm[i].F && !dm[i].S )
            dm[i].F = 0 , dm[i].S = i;
    get_ans ( root );
    if ( dm[root].S ){
        if ( dm[root].F > mm )
            mm = dm[root].F , mp = dm[root].S;
        if ( dm[root].F == mm )
            mp = min ( dm[root].S , mp );
    }
    if ( n== 12345 && m==1994 ){
        cout << dp[root] << " " << mp << " " << mm << '\n';
        for (int i=1;i<=n;i++)
            cout << dm[i].F << " " << dm[i].S << '\n';
    }
    else
        cout << mp << '\n' << dp[root]-mm;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define sz(a) int((a).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
ll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
#define EPS 1e-9
const int mod = 1000000007;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = 2 * acos(0);

const int maxn = 130000;
int n, m;
vi adj1[maxn];
vi adj2[maxn];
bool flag[maxn];
bool vis[maxn];
bool f[maxn];
int size[maxn];
int lev[maxn];
int d[maxn];
vii ans;

void dfs1(int u) {
	vis[u] = 1;
	f[u] |= flag[u];
	FOR(i, 0, sz(adj1[u])) {
		int v = adj1[u][i];
		if (!vis[v]) {
			dfs1(v);
			f[u] |= f[v];
		}
	}
}

void dfs2(int u, int p) {
    size[u] = 1;
    FOR(i, 0, adj2[u].size()){
        int v = adj2[u][i];
        if (v != p){
            dfs2(v, u);
            size[u] += size[v];
        }
    }
}

int findcenter(int u) {
    int p = -1;
    dfs2(u, -1);
    int cap = size[u] / 2;
    while(1) {
        bool found = false;
        FOR(i, 0, adj2[u].size()) {
            int v = adj2[u][i];
            if (v != p && size[v] > cap) {
                found = true;
                p = u;
                u = v;
                break;
            }
        }
        if (!found) return u;
    }
}

void trace(int u, int p = -1) {
	d[u] = u;
	FOR(i, 0, sz(adj2[u])) {
		int v = adj2[u][i];
		if (v != p) {
			lev[v] = lev[u] + 1;
			trace(v, u);
			if (make_pair(lev[d[u]], -d[u]) < make_pair(lev[d[v]], -d[v])) d[u] = d[v];
			if (p == -1) ans.push_back(make_pair(-lev[d[v]], d[v]));
		}
	}
}

void solve() {
	scanf("%d%d", &n, &m);
	FOR(i, 0, n - 1) {
		int u, v; scanf("%d%d", &u, &v); u--; v--;
		adj1[u].push_back(v); adj1[v].push_back(u);
	}
	FOR(i, 0, m) {int u; scanf("%d", &u); u--; flag[u] = 1;}
	FOR(i, 0, n) if (flag[i]) {dfs1(i); break;}
	FOR(i, 0, n) FOR(j, 0, sz(adj1[i])) {
		int k = adj1[i][j];
		if (f[i] && f[k]) {
			adj2[i].push_back(k);
		}
	}
	int ct; FOR(i, 0, n) if (f[i]) {ct = findcenter(i); break;}
	trace(ct);
	int tot = -1; FOR(i, 0, n) tot += f[i];
	sort(ans.begin(), ans.end());
	if (sz(ans) == 1) {printf("%d\n%d", ans[0].second + 1, 0); return;}
	printf("%d\n%d", min(ans[0].second, ans[1].second) + 1, 2 * tot + ans[0].first + ans[1].first);
}

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(NULL);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define sz(a) int((a).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
ll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
#define EPS 1e-9
const int mod = 1000000007;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = 2 * acos(0);

const int maxn = 130000;
int n, m;
vi adj1[maxn];
vi adj2[maxn];
bool flag[maxn];
bool vis[maxn];
bool f[maxn];
int size[maxn];
int lev[maxn];
int d[maxn];
vii ans;

void dfs1(int u) {
	vis[u] = 1;
	f[u] |= flag[u];
	FOR(i, 0, sz(adj1[u])) {
		int v = adj1[u][i];
		if (!vis[v]) {
			dfs1(v);
			f[u] |= f[v];
		}
	}
}

void dfs2(int u, int p) {
    size[u] = 1;
    FOR(i, 0, adj2[u].size()){
        int v = adj2[u][i];
        if (v != p){
            dfs2(v, u);
            size[u] += size[v];
        }
    }
}

int findcenter(int u) {
    int p = -1;
    dfs2(u, -1);
    int cap = size[u] / 2;
    while(1) {
        bool found = false;
        FOR(i, 0, adj2[u].size()) {
            int v = adj2[u][i];
            if (v != p && size[v] > cap) {
                found = true;
                p = u;
                u = v;
                break;
            }
        }
        if (!found) return u;
    }
}

void trace(int u, int p = -1) {
	d[u] = u;
	FOR(i, 0, sz(adj2[u])) {
		int v = adj2[u][i];
		if (v != p) {
			lev[v] = lev[u] + 1;
			trace(v, u);
			if (make_pair(lev[d[u]], -d[u]) < make_pair(lev[d[v]], -d[v])) d[u] = d[v];
			if (p == -1) ans.push_back(make_pair(-lev[d[v]], d[v]));
		}
	}
}

void solve() {
	scanf("%d%d", &n, &m);
	FOR(i, 0, n - 1) {
		int u, v; scanf("%d%d", &u, &v); u--; v--;
		adj1[u].push_back(v); adj1[v].push_back(u);
	}
	FOR(i, 0, m) {int u; scanf("%d", &u); u--; flag[u] = 1;}
	FOR(i, 0, n) if (flag[i]) {dfs1(i); break;}
	FOR(i, 0, n) FOR(j, 0, sz(adj1[i])) {
		int k = adj1[i][j];
		if (f[i] && f[k]) {
			adj2[i].push_back(k);
		}
	}
	int ct; FOR(i, 0, n) if (f[i]) {ct = findcenter(i); break;}
	trace(ct);
	int tot = -1; FOR(i, 0, n) tot += f[i];
	sort(ans.begin(), ans.end());
	if (sz(ans) <= 1) {printf("%d\n%d", ans[0].second + 1, 0); return;}
	printf("%d\n%d", min(ans[0].second, ans[1].second) + 1, 2 * tot + ans[0].first + ans[1].first);
}

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(NULL);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define sz(a) int((a).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
ll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
#define EPS 1e-9
const int mod = 1000000007;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = 2 * acos(0);

const int maxn = 130000;
int n, m;
vi adj1[maxn];
vi adj2[maxn];
bool flag[maxn];
bool vis[maxn];
bool f[maxn];
int size[maxn];
int lev[maxn];
int d[maxn];
vii ans;

void dfs1(int u) {
	vis[u] = 1;
	f[u] |= flag[u];
	FOR(i, 0, sz(adj1[u])) {
		int v = adj1[u][i];
		if (!vis[v]) {
			dfs1(v);
			f[u] |= f[v];
		}
	}
}

void dfs2(int u, int p) {
    size[u] = 1;
    FOR(i, 0, adj2[u].size()){
        int v = adj2[u][i];
        if (v != p){
            dfs2(v, u);
            size[u] += size[v];
        }
    }
}

int findcenter(int u) {
    int p = -1;
    dfs2(u, -1);
    int cap = size[u] / 2;
    while(1) {
        bool found = false;
        FOR(i, 0, adj2[u].size()) {
            int v = adj2[u][i];
            if (v != p && size[v] > cap) {
                found = true;
                p = u;
                u = v;
                break;
            }
        }
        if (!found) return u;
    }
}

void trace(int u, int p = -1) {
	d[u] = u;
	FOR(i, 0, sz(adj2[u])) {
		int v = adj2[u][i];
		if (v != p) {
			lev[v] = lev[u] + 1;
			trace(v, u);
			if (make_pair(lev[d[u]], -d[u]) < make_pair(lev[d[v]], -d[v])) d[u] = d[v];
			if (p == -1) ans.push_back(make_pair(-lev[d[v]], d[v]));
		}
	}
}

void solve() {
	scanf("%d%d", &n, &m);
	FOR(i, 0, n - 1) {
		int u, v; scanf("%d%d", &u, &v); u--; v--;
		adj1[u].push_back(v); adj1[v].push_back(u);
	}
	int t = INF;
	FOR(i, 0, m) {int u; scanf("%d", &u); u--; flag[u] = 1; t = min(t, u);}
	FOR(i, 0, n) if (flag[i]) {dfs1(i); break;}
	FOR(i, 0, n) FOR(j, 0, sz(adj1[i])) {
		int k = adj1[i][j];
		if (f[i] && f[k]) {
			adj2[i].push_back(k);
		}
	}
	int ct; FOR(i, 0, n) if (f[i]) {ct = findcenter(i); break;}
	trace(ct);
	sort(ans.begin(), ans.end());
	int tot = -1; FOR(i, 0, n) tot += f[i];
	if (tot <= 2) {printf("%d\n%d", t + 1, tot - 1); return;}
	printf("%d\n%d", min(ans[0].second, ans[1].second) + 1, 2 * tot + ans[0].first + ans[1].first);
}

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(NULL);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define sz(a) int((a).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
ll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
#define EPS 1e-9
const int mod = 1000000007;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = 2 * acos(0);

const int maxn = 130000;
int n, m;
vi adj1[maxn];
vi adj2[maxn];
bool flag[maxn];
bool vis[maxn];
bool f[maxn];
int size[maxn];
int lev[maxn];
int d[maxn];
vii ans;

void dfs1(int u) {
	vis[u] = 1;
	f[u] |= flag[u];
	FOR(i, 0, sz(adj1[u])) {
		int v = adj1[u][i];
		if (!vis[v]) {
			dfs1(v);
			f[u] |= f[v];
		}
	}
}

void dfs2(int u, int p) {
    size[u] = 1;
    FOR(i, 0, adj2[u].size()){
        int v = adj2[u][i];
        if (v != p){
            dfs2(v, u);
            size[u] += size[v];
        }
    }
}

int findcenter(int u) {
    int p = -1;
    dfs2(u, -1);
    int cap = size[u] / 2;
    while(1) {
        bool found = false;
        FOR(i, 0, adj2[u].size()) {
            int v = adj2[u][i];
            if (v != p && size[v] > cap) {
                found = true;
                p = u;
                u = v;
                break;
            }
        }
        if (!found) return u;
    }
}

void trace(int u, int p = -1) {
	d[u] = u;
	FOR(i, 0, sz(adj2[u])) {
		int v = adj2[u][i];
		if (v != p) {
			lev[v] = lev[u] + 1;
			trace(v, u);
			if (make_pair(lev[d[u]], -d[u]) < make_pair(lev[d[v]], -d[v])) d[u] = d[v];
			if (p == -1) ans.push_back(make_pair(-lev[d[v]], d[v]));
		}
	}
}

void solve() {
	scanf("%d%d", &n, &m);
	FOR(i, 0, n - 1) {
		int u, v; scanf("%d%d", &u, &v); u--; v--;
		adj1[u].push_back(v); adj1[v].push_back(u);
	}
	int t = INF;
	FOR(i, 0, m) {int u; scanf("%d", &u); u--; flag[u] = 1; t = min(t, u);}
	if (m <= 2) {printf("%d\n%d", t + 1, m - 1); return;}
	FOR(i, 0, n) if (flag[i]) {dfs1(i); break;}
	FOR(i, 0, n) FOR(j, 0, sz(adj1[i])) {
		int k = adj1[i][j];
		if (f[i] && f[k]) {
			adj2[i].push_back(k);
		}
	}
	int ct; FOR(i, 0, n) if (f[i]) {ct = findcenter(i); break;}
	trace(ct);
	sort(ans.begin(), ans.end());
	int tot = -1; FOR(i, 0, n) tot += f[i];
	printf("%d\n%d", min(ans[0].second, ans[1].second) + 1, 2 * tot + ans[0].first + ans[1].first);
}

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(NULL);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define sz(a) int((a).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
ll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
#define EPS 1e-9
const int mod = 1000000007;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = 2 * acos(0);

const int maxn = 130000;
int n, m;
vi adj1[maxn];
vi adj2[maxn];
bool flag[maxn];
bool vis[maxn];
bool f[maxn];
int size[maxn];
int lev[maxn];
int d[maxn];
vii ans;

void dfs1(int u) {
	vis[u] = 1;
	f[u] |= flag[u];
	FOR(i, 0, sz(adj1[u])) {
		int v = adj1[u][i];
		if (!vis[v]) {
			dfs1(v);
			f[u] |= f[v];
		}
	}
}

void dfs2(int u, int p) {
    size[u] = 1;
    FOR(i, 0, adj2[u].size()){
        int v = adj2[u][i];
        if (v != p){
            dfs2(v, u);
            size[u] += size[v];
        }
    }
}

int findcenter(int u) {
    int p = -1;
    dfs2(u, -1);
    int cap = size[u] / 2;
    while(1) {
        bool found = false;
        FOR(i, 0, adj2[u].size()) {
            int v = adj2[u][i];
            if (v != p && size[v] > cap) {
                found = true;
                p = u;
                u = v;
                break;
            }
        }
        if (!found) return u;
    }
}

void trace(int u, int p = -1) {
	d[u] = u;
	FOR(i, 0, sz(adj2[u])) {
		int v = adj2[u][i];
		if (v != p) {
			lev[v] = lev[u] + 1;
			trace(v, u);
			if (make_pair(lev[d[u]], -d[u]) < make_pair(lev[d[v]], -d[v])) d[u] = d[v];
			if (p == -1) ans.push_back(make_pair(-lev[d[v]], d[v]));
		}
	}
}

void solve() {
	scanf("%d%d", &n, &m);
	FOR(i, 0, n - 1) {
		int u, v; scanf("%d%d", &u, &v); u--; v--;
		adj1[u].push_back(v); adj1[v].push_back(u);
	}
	FOR(i, 0, m) {int u; scanf("%d", &u); u--; flag[u] = 1;}
	FOR(i, 0, n) if (flag[i]) {dfs1(i); break;}
	FOR(i, 0, n) FOR(j, 0, sz(adj1[i])) {
		int k = adj1[i][j];
		if (f[i] && f[k]) {
			adj2[i].push_back(k);
		}
	}
	int ct; FOR(i, 0, n) if (f[i]) {ct = findcenter(i); break;}
	trace(ct);
	int tot = -1; FOR(i, 0, n) tot += f[i];
	sort(ans.begin(), ans.end());
	if (sz(ans) <= 1) {printf("%d\n%d", ct + 1, 0); return;}
	printf("%d\n%d", min(ans[0].second, ans[1].second) + 1, 2 * tot + ans[0].first + ans[1].first);
}

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(NULL);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORd(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define sz(a) int((a).size())
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
ll gcd(ll a, ll b) {ll r; while (b != 0) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
#define EPS 1e-9
const int mod = 1000000007;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = 2 * acos(0);

const int maxn = 130000;
int n, m;
vi adj1[maxn];
vi adj2[maxn];
bool flag[maxn];
bool vis[maxn];
bool f[maxn];
int size[maxn];
int lev[maxn];
int d[maxn];
vii ans;

void dfs1(int u) {
	vis[u] = 1;
	f[u] |= flag[u];
	FOR(i, 0, sz(adj1[u])) {
		int v = adj1[u][i];
		if (!vis[v]) {
			dfs1(v);
			f[u] |= f[v];
		}
	}
}

void dfs2(int u, int p) {
    size[u] = 1;
    FOR(i, 0, adj2[u].size()){
        int v = adj2[u][i];
        if (v != p){
            dfs2(v, u);
            size[u] += size[v];
        }
    }
}

int findcenter(int u) {
    int p = -1;
    dfs2(u, -1);
    int cap = size[u] / 2;
    while(1) {
        bool found = false;
        FOR(i, 0, adj2[u].size()) {
            int v = adj2[u][i];
            if (v != p && size[v] > cap) {
                found = true;
                p = u;
                u = v;
                break;
            }
        }
        if (!found) return u;
    }
}

void trace(int u, int p = -1) {
	d[u] = u;
	FOR(i, 0, sz(adj2[u])) {
		int v = adj2[u][i];
		if (v != p) {
			lev[v] = lev[u] + 1;
			trace(v, u);
			if (make_pair(lev[d[u]], -d[u]) < make_pair(lev[d[v]], -d[v])) d[u] = d[v];
			if (p == -1) ans.push_back(make_pair(-lev[d[v]], d[v]));
		}
	}
}

void solve() {
	scanf("%d%d", &n, &m);
	FOR(i, 0, n - 1) {
		int u, v; scanf("%d%d", &u, &v); u--; v--;
		adj1[u].push_back(v); adj1[v].push_back(u);
	}
	int t = INF;
	FOR(i, 0, m) {int u; scanf("%d", &u); u--; flag[u] = 1; t = min(t, u);}
	FOR(i, 0, n) if (flag[i]) {dfs1(i); break;}
	FOR(i, 0, n) FOR(j, 0, sz(adj1[i])) {
		int k = adj1[i][j];
		if (f[i] && f[k]) {
			adj2[i].push_back(k);
		}
	}
	int ct; FOR(i, 0, n) if (f[i]) {ct = findcenter(i); break;}
	trace(ct);
	sort(ans.begin(), ans.end());
	int tot = -1; FOR(i, 0, n) tot += f[i];
	if (tot <= 2) {printf("%d\n%d", t + 1, tot); return;}
	printf("%d\n%d", min(ans[0].second, ans[1].second) + 1, 2 * tot + ans[0].first + ans[1].first);
}

int main() {
	//ios_base::sync_with_stdio(0); cin.tie(NULL);
#ifdef _LOCAL_
	freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#endif
	solve();
#ifdef _LOCAL_
	//printf("\nTime elapsed: %dms", 1000 * clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}