#include <bits/stdc++.h>
using namespace std;
const int num = 2e5 + 5;
int ver[2 * num], Next[2 * num], tot = 0;
int head[num];
int t;
int size[num];
void add(int x, int y) {
  ver[++tot] = y;
  Next[tot] = head[x];
  head[x] = tot;
}
int dep[num] = {0};
int fat[num][35];
void dfs(int x) {
  for (int i = 1; i <= t; i++) {
    fat[x][i] = fat[fat[x][i - 1]][i - 1];
  }
  for (int i = head[x]; i; i = Next[i]) {
    int y = ver[i];
    if (dep[y]) continue;
    dep[y] = dep[x] + 1;
    fat[y][0] = x;
    dfs(y);
    size[x] += size[y];
  }
}
int lca(int x, int y) {
  if (dep[x] > dep[y]) swap(x, y);
  for (int i = t; i >= 0; i--) {
    if (dep[fat[y][i]] >= dep[x]) y = fat[y][i];
  }
  if (x == y) return x;
  for (int i = t; i >= 0; i--) {
    if (fat[x][i] != fat[y][i]) {
      x = fat[x][i];
      y = fat[y][i];
    }
  }
  return fat[x][0];
}
int main() {
  int n, m, k, i, j;
  bool vis[num] = {0};
  scanf("%d%d", &n, &k);
  dep[1] = 1;
  t = (int)(log(n) / log(2)) + 1;
  for (i = 1; i <= 2 * k; i++) {
    scanf("%d", &j);
    size[j] = 1;
  }
  for (i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1);
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    for (j = head[i]; j; j = Next[j]) {
      int temp = ver[j];
      if (dep[temp] < dep[i]) {
        temp = i;
      }
      ans += min(2 * k - size[temp], size[temp]);
    }
  }
  printf("%lld\n", ans / 2);
}
