#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200200;
int n, k, cnt[MAXN];
long long ans;
bool f[MAXN];
vector<int> g[MAXN];
void dfs(int v, int p = -1) {
  cnt[v] = f[v];
  for (const int &u : g[v])
    if (u != p) dfs(u, v), cnt[v] += cnt[u];
}
void solve(int v, int p = -1) {
  for (const int &u : g[v])
    if (u != p) {
      ans += min(2 * k - cnt[u], cnt[u]);
      solve(u, v);
    }
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1, x; i <= 2 * k; ++i) scanf("%d", &x), f[x] = true;
  for (int i = 1, u, v; i < n; ++i)
    scanf("%d %d", &u, &v), g[u].push_back(v), g[v].push_back(u);
  dfs(1);
  solve(1);
  printf("%lld\n", ans);
}
