#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100, L = 23;
vector<int> adj[N], vec;
bool use[N];
int par[N][L], h[N];
int n, k;
long long cnt;
void dfs(int v, int p) {
  par[v][0] = p;
  for (int i = 1; i < L; i++) par[v][i] = par[par[v][i - 1]][i - 1];
  for (auto u : adj[v]) {
    if (u == p) continue;
    h[u] = h[v] + 1;
    dfs(u, v);
  }
  if (use[v]) {
    vec.push_back(v);
  }
}
int get_H(int v, int h) {
  for (int i = 0; i < L; i++)
    if ((h >> i) & 1) v = par[v][i];
  return v;
}
int LCA(int v, int u) {
  if (h[v] > h[u]) swap(v, u);
  u = get_H(u, h[u] - h[v]);
  if (v == u) return v;
  for (int i = L - 1; i >= 0; i--)
    if (par[v][i] != par[u][i]) {
      v = par[v][i];
      u = par[u][i];
    }
  return par[v][0];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < 2 * k; i++) {
    int v;
    cin >> v;
    use[v] = true;
  }
  for (int i = 0; i < n - 1; i++) {
    int v, u;
    cin >> v >> u;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  dfs(1, 1);
  for (int i = 0; i < k; i++) {
    int lca = LCA(vec[i], vec[k + i]);
    cnt += h[vec[i]] + h[vec[k + i]] - 2 * h[lca];
  }
  return cout << cnt, 0;
}
