#include <bits/stdc++.h>
using namespace std;
const int N = 200020;
int hd[N], to[N * 2], nx[N * 2], tot;
void conn(int u, int v) {
  to[tot] = v;
  nx[tot] = hd[u];
  hd[u] = tot++;
}
bool f[N];
int n, k;
long long ans;
int dfs(int u, int p) {
  int cnt = f[u];
  for (int e = hd[u]; ~e; e = nx[e]) {
    if (to[e] != p) {
      int t = dfs(to[e], u);
      ans += t;
      cnt += t;
    }
  }
  while (cnt > k) cnt -= 2, k -= 1;
  return cnt;
}
int main() {
  int u, v;
  while (scanf("%d%d", &n, &k) == 2) {
    tot = 0;
    memset(hd, -1, sizeof hd);
    memset(f, 0, sizeof f);
    for (int i = 0; i < k * 2; ++i) scanf("%d", &u), f[u] = true;
    for (int i = 1; i < n; ++i) {
      scanf("%d%d", &u, &v);
      conn(u, v);
      conn(v, u);
    }
    ans = 0;
    dfs(1, -1);
    cout << ans << endl;
  }
  return 0;
}
