#include <bits/stdc++.h>
using namespace std;
vector<int> g[200005];
int n, k, num[200005];
struct Edges {
  int u, v;
} edge[200005];
int dfs(int cur, int par) {
  int i, now;
  for (i = 0; i < g[cur].size(); ++i) {
    now = g[cur][i];
    if (now == par) continue;
    num[cur] += dfs(now, cur);
  }
  return num[cur];
}
int main() {
  int i, from, to, tmp;
  scanf("%d%d", &n, &k);
  for (i = 0; i < 2 * k; ++i) {
    scanf("%d", &to);
    num[to] = 1;
  }
  for (i = 0; i < n - 1; ++i) {
    scanf("%d%d", &from, &to);
    edge[i].u = from, edge[i].v = to;
    g[to].push_back(from);
    g[from].push_back(to);
  }
  dfs(1, 0);
  long long ret = 0;
  Edges e;
  for (i = 0; i < n - 1; ++i) {
    e = edge[i];
    tmp = num[e.u] < num[e.v] ? num[e.u] : num[e.v];
    ret += tmp < 2 * k - tmp ? tmp : 2 * k - tmp;
  }
  printf("%lld", ret);
  return 0;
}
