#include <bits/stdc++.h>
using namespace std;
bool uni[200010];
int sub[200010];
vector<int> adjList[200010];
int dfs(int node, int p = -1) {
  sub[node] = uni[node];
  for (int nxt : adjList[node]) {
    if (nxt == p) continue;
    sub[node] += dfs(nxt, node);
  }
  return sub[node];
}
int main(void) {
  int n, k;
  scanf("%d", &n);
  scanf("%d", &k);
  memset(uni, false, sizeof(uni));
  for (int i = 0; i < 2 * k; i++) {
    int x;
    scanf("%d", &x);
    uni[x] = true;
  }
  for (int i = 0; i < n - 1; i++) {
    int fr, to;
    scanf("%d", &fr);
    scanf("%d", &to);
    adjList[fr].push_back(to);
    adjList[to].push_back(fr);
  }
  dfs(1);
  long long tot = 0;
  for (int i = 1; i <= n; i++) {
    tot += min(sub[i], 2 * k - sub[i]);
  }
  cout << tot;
  return 0;
}
