#include <bits/stdc++.h>
using namespace std;
list<int> adjList[200002];
int depth[200002];
int sz[200002];
class LCA_binary {
  int logn, timer;
  vector<int> tin, tout;
  vector<vector<int>> up;

 public:
  void innerdfs(int v, int p) {
    tin[v] = ++timer;
    up[v][0] = p;
    for (int i = 1; i <= logn; ++i) up[v][i] = up[up[v][i - 1]][i - 1];
    for (int u : adjList[v]) {
      if (u != p) innerdfs(u, v);
    }
    tout[v] = ++timer;
  }
  bool is_ancestor(int u, int v) {
    return tin[u] <= tin[v] && tout[u] >= tout[v];
  }
  int lca(int u, int v) {
    if (is_ancestor(u, v)) return u;
    if (is_ancestor(v, u)) return v;
    for (int i = logn; i >= 0; --i) {
      if (!is_ancestor(up[u][i], v)) u = up[u][i];
    }
    return up[u][0];
  }
  void preprocess(int n, int root) {
    tin.resize(n + 3);
    tout.resize(n + 3);
    timer = 0;
    logn = ceil(log2(n));
    up.assign(n + 3, vector<int>(logn + 1));
    innerdfs(root, root);
  }
};
set<int> s;
vector<int> univ;
int deep(int i, int p, int d) {
  depth[i] = d++;
  if (s.count(i)) univ.push_back(i);
  sz[i] = 1;
  for (int v : adjList[i])
    if (v != p) sz[i] += deep(v, i, d);
  return sz[i];
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (k << 1); i++) {
    int t;
    cin >> t;
    s.insert(t);
  }
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    adjList[a].push_back(b);
    adjList[b].push_back(a);
  }
  LCA_binary f;
  f.preprocess(n, 1);
  deep(1, 0, 0);
  long long ans = 0LL;
  for (int i = 0; i < k; i++)
    ans += (long long)(depth[univ[i]] + depth[univ[i + k]] -
                       (depth[f.lca(univ[i], univ[i + k])] << 1));
  cout << ans << "\n";
  return 0;
}
