#include <bits/stdc++.h>
int n, k, s[200005], eh[200005], ep;
long long ans;
bool mk[200005];
class edge {
 public:
  int v, next;
} e[200005 << 1];
void add_edge(int u, int v) {
  e[ep].v = v;
  e[ep].next = eh[u];
  eh[u] = ep++;
  e[ep].v = u;
  e[ep].next = eh[v];
  eh[v] = ep++;
}
void dfs(int u, int p) {
  for (int i = eh[u]; i != -1; i = e[i].next) {
    if (e[i].v == p) continue;
    dfs(e[i].v, u);
    s[u] += s[e[i].v];
  }
  if (mk[u]) ++s[u];
  ans += (long long)std::min(s[u], 2 * k - s[u]);
}
int main() {
  scanf("%d%d", &n, &k);
  memset(eh, -1, sizeof(eh));
  for (int i = 0, u; i < 2 * k; ++i) {
    scanf("%d", &u);
    mk[u] = true;
  }
  for (int i = 0, u, v; i < n - 1; ++i) {
    scanf("%d%d", &u, &v);
    add_edge(u, v);
  }
  dfs(1, -1);
  printf("%I64d\n", ans);
  return 0;
}
