#include <bits/stdc++.h>
const bool DEBUG = false;
using namespace std;
const long long maxn = 2e5 + 5;
const long long INF = 4e18;
const long long M = 1e9 + 7;
const int lg = 21;
int n, k, x, u[maxn], d[maxn], t[maxn], h[maxn];
long long ans;
vector<int> g[maxn];
int centroid(int v, int p = -1) {
  for (auto u : g[v]) {
    if (u != p and t[u] > k) return centroid(u, v);
  }
  return v;
}
void dfs(int v, int p = -1) {
  for (auto u : g[v]) {
    if (u != p) {
      h[u] = h[v] + 1;
      dfs(u, v);
      t[v] += t[u];
    }
  }
  if (u[v]) t[v]++, ans += h[v];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < 2 * k; i++) cin >> x, u[--x] = 1;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y, x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(0);
  int cen = centroid(0);
  fill(h, h + maxn, 0);
  fill(t, t + maxn, 0);
  ans = 0;
  dfs(cen);
  cout << ans << endl;
  return 0;
}
