#include <bits/stdc++.h>
const int MAXN = 200005;
int n, k;
int size[MAXN];
struct edge {
  edge *next;
  int y;
};
edge *first[MAXN], e[MAXN * 2], *etot = e;
inline void addedge(int x, int y) {
  *++etot = (edge){first[x], y};
  first[x] = etot;
}
void dfs(int x, int last) {
  for (edge *e = first[x]; e; e = e->next) {
    if (e->y != last) {
      dfs(e->y, x);
      size[x] += size[e->y];
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= 2 * k; i++) {
    int x;
    scanf("%d", &x);
    size[x] = 1;
  }
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    addedge(u, v);
    addedge(v, u);
  }
  dfs(1, 0);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += std::min(size[i], 2 * k - size[i]);
  }
  printf("%I64d\n", ans);
}
