#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2e5 + 10;
int n, k, f[Maxn];
int fir[Maxn], nxt[Maxn << 1], to[Maxn << 1], cnt = 0;
long long ans = 0;
void add(int a, int b) {
  nxt[++cnt] = fir[a];
  fir[a] = cnt;
  to[cnt] = b;
  return;
}
void dfs(int now, int fa) {
  for (int i = fir[now]; i; i = nxt[i])
    if (to[i] != fa) {
      dfs(to[i], now);
      f[now] += f[to[i]];
      ans += min(f[to[i]], k - f[to[i]]);
    }
  return;
}
int main() {
  scanf("%d %d", &n, &k);
  k *= 2;
  for (int i = 1; i <= k; ++i) {
    int x;
    scanf("%d", &x);
    f[x] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    add(u, v);
    add(v, u);
  }
  dfs(1, 0);
  return printf("%I64d\n", ans), 0;
}
