#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int u[MAXN];
typedef struct {
  int u, v;
} Edge;
Edge e[MAXN];
vector<int> G[MAXN];
int cmin(int a, int b) { return a < b ? a : b; }
int dfs(int n, int parent) {
  int i;
  int s = G[n].size();
  for (i = 0; i < s; i++) {
    int t = G[n][i];
    if (G[n][i] == parent) continue;
    u[n] += dfs(t, n);
  }
  return u[n];
}
int main() {
  int n, k, i;
  scanf("%d%d", &n, &k);
  for (i = 1; i <= 2 * k; i++) {
    int x;
    scanf("%d", &x);
    u[x] = 1;
  }
  for (i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    e[i].u = u;
    e[i].v = v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, -1);
  long long ans = 0;
  for (i = 1; i <= n - 1; i++) {
    int t = cmin(u[e[i].u], u[e[i].v]);
    int d = cmin(2 * k - t, t);
    ans += d;
  }
  printf("%I64d\n", ans);
  return 0;
}
