#include <bits/stdc++.h>
using namespace std;
const int N = 200007;
const int M = 2 * N;
int hd[N], to[M], nx[M], es;
int sp[N], n, k;
long long int qt[N];
long long int dfs(int u, int fr) {
  qt[u] = sp[u];
  long long int res = 0;
  for (int ed = hd[u]; ed; ed = nx[ed]) {
    if (to[ed] == fr) continue;
    res += dfs(to[ed], u);
    qt[u] += qt[to[ed]];
  }
  res += min(qt[u], 2ll * k - qt[u]);
  return res;
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < 2 * k; i++) {
    int a;
    scanf("%d", &a);
    a--;
    sp[a]++;
  }
  es = 2;
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    nx[es] = hd[a];
    to[es] = b;
    hd[a] = es++;
    nx[es] = hd[b];
    to[es] = a;
    hd[b] = es++;
  }
  printf("%I64d\n", dfs(0, 0));
}
