#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, k, size[maxn];
bool f[maxn];
long long dp[maxn];
vector<int> g[maxn];
void dfs(int u, int fa) {
  if (f[u])
    size[u] = 1;
  else
    size[u] = 0;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == fa) continue;
    dfs(v, u);
    size[u] += size[v];
    dp[u] += dp[v] + size[v];
  }
}
long long ans = 0;
int solve(int u, int fa) {
  int sum = (f[u] ? 1 : 0);
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == fa) continue;
    sum += solve(v, u);
  }
  ans += min(sum, 2 * k - size[u]);
  return min(sum, 2 * k - size[u]);
}
int main() {
  scanf("%d%d", &n, &k);
  int x;
  for (int i = 1; i <= 2 * k; i++) scanf("%d", &x), f[x] = 1;
  int u, v;
  for (int i = 1; i <= n - 1; i++)
    scanf("%d%d", &u, &v), g[u].push_back(v), g[v].push_back(u);
  dfs(1, -1);
  solve(1, -1);
  printf("%lld\n", ans);
  return 0;
}
