#include <bits/stdc++.h>
using namespace std;
long long n, k, deg[200005], val, ans, mak[200005], dp[200005], par[200005], u,
    v;
vector<long long> adj[200005], uni;
queue<int> q;
void f(long long x) {
  dp[x] = 0;
  for (int i : adj[x])
    if (i != par[x]) {
      if (dp[i] == -1) f(i);
    }
  if (mak[x]) dp[x]++;
  dp[par[x]] += dp[x];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < 2 * k; i++) {
    cin >> val;
    val--;
    uni.push_back(val);
    mak[val] = 1;
  }
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  memset(deg, -1, sizeof(deg));
  deg[0] = 0;
  q.push(0);
  par[0] = -1;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (int nex : adj[u])
      if (deg[nex] == -1) {
        deg[nex] = 1 + deg[u];
        par[nex] = u;
        q.push(nex);
      }
  }
  for (int i : uni) ans += deg[i];
  memset(dp, -1, sizeof(dp));
  f(0);
  q.push(0);
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (int nex : adj[u])
      if (nex != par[u] && dp[nex] > k) {
        ans -= 2 * (dp[nex] - k);
        q.push(nex);
        break;
      }
  }
  cout << ans;
}
