#include <bits/stdc++.h>
using namespace std;
inline int IN() {
  char c;
  register int first = 0;
  for (; (c = getchar()) < 48 && c ^ '-' || c > 57;)
    ;
  bool f = c == '-';
  if (f) (c = getchar());
  for (; c > 47 && c < 58; (c = getchar()))
    first = (first << 3) + (first << 1) + c - 48;
  if (f) first = -first;
  return first;
}
inline void glance() { freopen("ha.in", "r", stdin); }
long long ans;
int K, n, bo[200010], sz[200010], dep[200010];
vector<int> Ed[200010];
void gs(int u, int ff = 0) {
  for (int v : Ed[u])
    if (v ^ ff) gs(v, u), sz[u] += sz[v];
  sz[u] += bo[u];
}
int grt(int u) {
  int w = 0, maxx = 0;
  for (int v : Ed[u])
    if (sz[v] > maxx) maxx = sz[v], w = v;
  if (maxx * 2 > sz[u]) {
    sz[u] -= sz[w];
    sz[w] += sz[u];
    return grt(w);
  }
  return u;
}
void gao(int u, int ff = 0) {
  if (bo[u]) ans += dep[u];
  for (int v : Ed[u])
    if (v ^ ff) dep[v] = dep[u] + 1, gao(v, u);
}
int main() {
  n = IN();
  K = IN();
  for (int _r = 2 * K, i = 1; i <= _r; ++i) bo[IN()] = 1;
  for (int _r = n, i = 1; i < _r; ++i) {
    int u = IN(), v = IN();
    Ed[u].push_back(v);
    Ed[v].push_back(u);
  }
  gs(1);
  int root = grt(1);
  gao(root);
  printf("%I64d\n", ans);
}
