#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char c;
  T t = 1;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-') {
    t = -1;
    c = getchar();
  }
  do (x *= 10) += (c - '0');
  while ((c = getchar()) >= '0' && c <= '9');
  x *= t;
}
template <typename T>
void write(T x) {
  int len = 0;
  char c[21];
  if (x < 0) putchar('-'), x *= (-1);
  do {
    ++len;
    c[len] = (x % 10) + '0';
  } while (x /= 10);
  for (int i = (len); i >= (1); --i) putchar(c[i]);
}
const int mod = 1e9 + 7;
const int NUM = 2e5 + 5;
const int MAXN = NUM << 1;
int n, k, head[NUM] = {}, edgenum = 0;
long long cnt[NUM], ans = 0;
bool check[NUM] = {};
struct edge {
  int to, next;
} e[MAXN];
inline void addedge(const int &u, const int &v) {
  e[++edgenum] = edge{v, head[u]}, head[u] = edgenum;
  e[++edgenum] = edge{u, head[v]}, head[v] = edgenum;
}
void dfs(int v, int pre) {
  int u;
  cnt[v] = check[v] ? 1 : 0;
  for (int i = head[v]; i; i = e[i].next) {
    u = e[i].to;
    if (u == pre) continue;
    dfs(u, v);
    cnt[v] += cnt[u];
  }
  ans += min(cnt[v], k - cnt[v]);
}
inline void ac() {
  int x, u, v;
  read(n), read(k);
  k <<= 1;
  for (int i = (1); i <= (k); ++i) {
    read(x);
    check[x] = true;
  }
  for (int i = (2); i <= (n); ++i) {
    read(u), read(v);
    addedge(u, v);
  }
  dfs(1, 1);
  write(ans);
}
int main() {
  ac();
  return 0;
}
