#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool f = 0;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = 1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return f ? -x : x;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  puts("");
}
void writep(long long x) {
  write(x);
  putchar(' ');
}
long long const N = 2e5 + 3;
long long n, m, cnt, ans, size[N], h[N];
struct edge {
  long long nt, to;
} e[N << 1];
void add(long long x, long long y) {
  e[++cnt] = (edge){h[x], y};
  h[x] = cnt;
}
void dfs(long long x, long long fa) {
  for (long long i = h[x]; i; i = e[i].nt) {
    long long v = e[i].to;
    if (v == fa) continue;
    dfs(v, x);
    ans += min(size[v], m - size[v]);
    size[x] += size[v];
  }
}
signed main() {
  n = read();
  m = read() << 1;
  for (long long i = 1; i <= m; i++) size[read()] = 1;
  for (long long i = 1, x, y; i < n; i++) {
    x = read(), y = read();
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  writeln(ans);
  return 0;
}
