#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int read() {
  int x = 0, f = 1;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (f = -f);
  for (x = ch ^ 48; isdigit(ch = getchar());
       x = (x << 3) + (x << 1) + (ch ^ 48))
    ;
  return x * f;
}
template <class T>
T Max(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T Min(T a, T b) {
  return a < b ? a : b;
}
struct Edge {
  int to;
  Edge *nxt;
  Edge(int to, Edge *nxt) : to(to), nxt(nxt) {}
} * head[N];
void add(int x, int y) { head[x] = new Edge(y, head[x]); }
int n, k;
long long ans, f[N];
void dfs(int x, int fa) {
  for (Edge *i = head[x]; i; i = i->nxt) {
    if (i->to == fa) continue;
    dfs(i->to, x);
    f[x] += f[i->to];
    ans += min(f[i->to], k - f[i->to]);
  }
}
int main() {
  n = read();
  k = read() * 2;
  for (int i = 1; i <= k; ++i) f[read()] = 1;
  for (int i = 1, x, y; i < n; ++i)
    x = read(), y = read(), add(x, y), add(y, x);
  dfs(1, 0);
  printf("%lld\n", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
