#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%I64d", &x);
  return x;
}
vector<int> G[N + N];
pair<int, int> edg[N + N];
int n, k, start;
int inp[N + N];
int st[N + N], T = 1;
long long res, f[N + N];
void dfs(int u, int par) {
  st[u] = T++;
  if (inp[u] == 1) f[u]++;
  for (int i = 0; i < (int)G[u].size(); i++) {
    int v = G[u][i];
    if (v != par) {
      dfs(v, u);
      f[u] += f[v];
      res += min(f[v], 2LL * k - f[v]);
    }
  }
}
int main() {
  n = in();
  k = in();
  for (int i = 1; i <= k + k; i++) {
    int x = in();
    inp[x] = 1;
  }
  for (int i = 1; i <= n - 1; i++) {
    int u = in(), v = in();
    G[u].push_back(v);
    G[v].push_back(u);
    edg[i] = make_pair(u, v);
  }
  res = 0;
  dfs(1, -1);
  printf("%I64d\n", res);
}
