#include <bits/stdc++.h>
using namespace std;
long long st[2000006], level[2000006], en[2000006], ma[2000006], i, n, k, x, a,
    b, bit[2000006], M[2 * 200005][20];
vector<long long> euler, v[2000006];
vector<pair<long long, long long> > vec;
void update(long long x, long long val) {
  while (x <= euler.size()) {
    bit[x] += val;
    x += x & -x;
  }
}
long long read(long long x) {
  long long sum = 0;
  while (x > 0) {
    sum += bit[x];
    x -= x & -x;
  }
  return sum;
}
void dfs(long long x, long long pa, long long lev) {
  st[x] = euler.size();
  euler.push_back(x);
  level[x] = lev;
  for (long long i = 0; i < v[x].size(); i++) {
    if (v[x][i] == pa) continue;
    dfs(v[x][i], x, lev + 1);
    en[x] = euler.size();
    euler.push_back(x);
  }
}
void sparse_table() {
  long long i, j, N = euler.size();
  for (i = 0; i < N; i++) M[i][0] = i;
  for (j = 1; 1 << j <= N; j++)
    for (i = 0; i + (1 << j) - 1 < N; i++)
      if (level[euler[M[i][j - 1]]] <
          level[euler[M[i + (1 << (j - 1))][j - 1]]])
        M[i][j] = M[i][j - 1];
      else
        M[i][j] = M[i + (1 << (j - 1))][j - 1];
}
long long lca(long long x, long long y) {
  x = st[x];
  y = st[y];
  if (x < y) swap(x, y);
  long long k = log2(x - y + 1);
  if (level[euler[M[y][k]]] <= level[euler[M[x - (1 << k) + 1][k]]])
    return euler[M[y][k]];
  else
    return euler[M[x - (1 << k) + 1][k]];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (i = 0; i < 2 * k; i++) {
    cin >> x;
    ma[x] = 1;
  }
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(1, -1, 0);
  sparse_table();
  for (i = 0; i < euler.size(); i++) {
    if (ma[euler[i]] == 1) {
      vec.push_back(make_pair(level[euler[i]], euler[i]));
      ma[euler[i]] = 0;
    }
  }
  long long ans = 0;
  for (i = 0; i < vec.size() / 2; i++) {
    ans += level[vec[i + k].second] + level[vec[i].second];
    ans -= 2 * level[lca(vec[i + k].second, vec[i].second)];
  }
  cout << ans;
  return 0;
}
