#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, k;
long long ans, fa[N], tot[N];
vector<int> es[N];
void dfs(int x) {
  for (int i = 0; i < es[x].size(); i++) {
    int v = es[x][i];
    if (v != fa[x]) {
      fa[v] = x;
      dfs(v);
      tot[x] += tot[v];
    }
  }
}
signed main() {
  scanf("%d %d", &n, &k);
  for (int i = 1, x; i <= k << 1; i++) {
    scanf("%d", &x);
    tot[x]++;
  }
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d %d", &u, &v);
    es[u].push_back(v);
    es[v].push_back(u);
  }
  dfs(1);
  for (int i = 2; i <= n; i++) {
    ans += min(tot[i], tot[1] - tot[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
