#include <bits/stdc++.h>
using namespace std;
vector<int> adj[200010];
int visited[200010];
int inpair[200010];
long long result;
int tot;
int dfs(int i) {
  int j;
  int pcnt, points = 0;
  for (j = 0; j < adj[i].size(); j++) {
    if (visited[adj[i][j]] == 0) {
      visited[adj[i][j]] = 1;
      pcnt = dfs(adj[i][j]) + inpair[adj[i][j]];
      result += (long long)min(pcnt, tot - pcnt);
      points += pcnt;
    }
  }
  return points;
}
int main() {
  int n, k;
  int u, v;
  int i, j;
  int town;
  scanf("%d%d", &n, &k);
  tot = 2 * k;
  result = 0;
  for (i = 0; i < k * 2; i++) {
    scanf("%d", &town);
    inpair[town] = 1;
  }
  for (i = 0; i < n - 1; i++) {
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  visited[1] = 1;
  dfs(1);
  printf("%I64d\n", result);
  return 0;
}
