#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
struct Node {
  int y, next;
} edge[N << 1];
int head[N], cnt, n, m, k, siz[N], a[N];
void init() {
  memset(head, -1, sizeof(head));
  cnt = 0;
}
void add(int x, int y) {
  edge[cnt].y = y;
  edge[cnt].next = head[x];
  head[x] = cnt++;
}
long long dfs(int x, int fa, int k) {
  long long tot = 0;
  siz[x] = a[x];
  for (int i = head[x]; ~i; i = edge[i].next) {
    int y = edge[i].y;
    if (y == fa) continue;
    tot += dfs(y, x, k);
    siz[x] += siz[y];
    tot += min(k - siz[y], siz[y]);
  }
  return tot;
}
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    init();
    memset(a, 0, sizeof(a));
    for (int i = 0; i < k * 2; i++) {
      int x;
      scanf("%d", &x);
      a[x] = 1;
    }
    for (int i = 1; i < n; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      add(x, y);
      add(y, x);
    }
    long long ans = dfs(1, -1, k * 2);
    printf("%I64d\n", ans);
  }
  return 0;
}
