#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7, N = 2e5 + 10;
int uni[N];
int cnt[N];
vector<int> adj[N];
long long conv;
void dfs1(int u, int p, int d) {
  if (uni[u]) conv += d;
  cnt[u] += uni[u];
  for (int v : adj[u]) {
    if (v == p) continue;
    dfs1(v, u, d + 1);
    cnt[u] += cnt[v];
  }
}
long long dfs2(int u, int p, int ign) {
  long long ans = 0;
  int s = 0;
  for (int v : adj[u]) {
    if (v == p) continue;
    s += cnt[v];
  }
  s += uni[u];
  for (int v : adj[u]) {
    if (v == p) continue;
    int other = s - cnt[v];
    if (cnt[v] - ign - other > 0) {
      ans += (cnt[v] - ign - other) / 2;
      ans += dfs2(v, u, ign + other);
    }
  }
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < 2 * k; ++i) {
    int a;
    scanf("%d", &a);
    uni[a] = 1;
  }
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs1(1, -1, 0);
  long long ans = dfs2(1, -1, 0);
  cout << conv - 2 * ans << '\n';
}
