#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-10;
const long long mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxn = 200005;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, k, tot;
struct edge {
  int to, nxt;
} es[maxn * 2];
int head[maxn], num[maxn], vis[maxn];
long long ans;
map<int, int> ma;
void init() {
  tot = 0;
  memset(head, -1, sizeof(head));
}
void addEdge(int u, int v) {
  es[tot].to = v;
  es[tot].nxt = head[u];
  head[u] = tot++;
}
void dfs(int u, int fa) {
  num[u] = 0;
  if (vis[u]) num[u]++;
  for (int i = head[u]; i != -1; i = es[i].nxt) {
    int v = es[i].to;
    if (v == fa) continue;
    dfs(v, u);
    num[u] += num[v];
  }
}
int main(void) {
  scanf("%d%d", &n, &k);
  int x, y;
  for (int i = 1; i <= 2 * k; i++) scanf("%d", &x), vis[x] = 1;
  init();
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d%d", &x, &y);
    addEdge(x, y);
    addEdge(y, x);
  }
  dfs(1, 0);
  ans = 0;
  for (int i = 2; i <= n; i++) {
    ans += min(num[i], 2 * k - num[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
