#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, c, d, k, h[200009], w, x, y, p, q, t;
long long ans, res, ma, mi, T;
vector<int> v[200009];
int sub[200009];
void dfs(int id, int par) {
  for (int i = 0; i < v[id].size(); i++) {
    int u = v[id][i];
    if (u == par) continue;
    dfs(u, id);
    sub[id] += sub[u];
  }
  if (h[id] == 1) sub[id]++;
}
void calc(int id, int par, int dist = 0) {
  if (h[id] == 1) ans += dist;
  for (int i = 0; i < v[id].size(); i++) {
    int u = v[id][i];
    if (u == par) continue;
    calc(u, id, dist + 1);
  }
}
int root(int id, int par) {
  if (sub[id] == k) return id;
  for (int i = 0; i < v[id].size(); i++) {
    int u = v[id][i];
    if (u == par) continue;
    if (sub[u] >= k) return root(u, id);
  }
  return id;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 1; i <= 2 * k; i++) {
    cin >> p;
    h[p] = 1;
  }
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, 0);
  a = root(1, 0);
  calc(a, 0);
  cout << ans;
  return 0;
}
