#include <bits/stdc++.h>
using namespace std;
vector<int> T[int(2e5 + 5)];
bool uni[int(2e5 + 5)];
int s[int(2e5 + 5)];
void dfs(int u = 1, int p = 0) {
  if (uni[u]) s[u]++;
  for (int v : T[u])
    if (v != p) {
      dfs(v, u);
      s[u] += s[v];
    }
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, k;
  scanf("%d%d", &(n), &(k));
  for (int i = 1, __R = k << 1; i <= __R; i++) {
    int u;
    scanf("%d", &(u));
    uni[u] = true;
  }
  for (int i = 1, __R = n - 1; i <= __R; i++) {
    int u, v;
    scanf("%d%d", &(u), &(v));
    T[u].push_back(v);
    T[v].push_back(u);
  }
  dfs();
  long long ans = 0;
  for (int i = 1, __R = n; i <= __R; i++) ans += min(s[i], (k << 1) - s[i]);
  printf("%lld\n", ans);
  return 0;
}
