#include <bits/stdc++.h>
using namespace std;
long long n, k;
set<long long> w;
long long st[(long long)1e6];
long long en[(long long)1e6], sa[(long long)1e6];
long long carai = 0;
long long dpth[(long long)1e6];
vector<long long> adj[(long long)1e6];
long long sz[(long long)1e6];
void pre_dfs(long long x, long long y) {
  en[x] = ++carai;
  dpth[x] = dpth[y] + 1;
  sz[x] = 0;
  if (w.count(x)) sz[x]++;
  for (auto p : adj[x]) {
    if (p == y) continue;
    pre_dfs(p, x);
    sz[x] += sz[p];
  }
  sa[x] = carai;
}
int32_t main() {
  scanf("%lld%lld", &n, &k);
  for (long long i = 0; i < 2 * k; i++) {
    long long x;
    scanf("%lld", &x);
    x--;
    w.insert(x);
  }
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dpth[0] = -1;
  pre_dfs(0, 0);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += min(sz[i], 2 * k - sz[i]);
  }
  printf("%lld\n", ans);
}
