#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int u, v;
} E[200000 + 10];
bool flag[200000 + 10];
int Node[2 * 200000 + 10], Next[2 * 200000 + 10], Head[200000 + 10], tot = 0;
int Size[200000 + 10], Deep[200000 + 10];
int n, k;
long long ans;
void link(int u, int v) {
  Node[++tot] = v;
  Next[tot] = Head[u];
  Head[u] = tot;
}
void DFS(int x, int F) {
  Size[x] = flag[x];
  for (int p = Head[x]; p; p = Next[p]) {
    if (Node[p] == F) continue;
    Deep[Node[p]] = Deep[x] + 1;
    DFS(Node[p], x);
    Size[x] += Size[Node[p]];
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= 2 * k; i++) {
    int x;
    scanf("%d", &x);
    flag[x] = 1;
  }
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &E[i].u, &E[i].v);
    link(E[i].u, E[i].v);
    link(E[i].v, E[i].u);
  }
  DFS(1, 0);
  for (int i = 1; i < n; i++) {
    if (Deep[E[i].u] < Deep[E[i].v]) swap(E[i].u, E[i].v);
    ans += min(Size[E[i].u], 2 * k - Size[E[i].u]);
  }
  printf("%I64d\n", ans);
  return 0;
}
