#include <bits/stdc++.h>
using namespace std;
bool ok[200050];
int n;
long long m;
long long int b[200050];
vector<int> v[200050];
bool vis[200050];
long long int dfs(int x) {
  if (b[x] != -1) return b[x];
  int siz = v[x].size();
  long long int r = 0;
  if (ok[x]) r++;
  for (int i = 0; i < siz; i++) {
    int vv = v[x][i];
    if (vis[vv]) {
      vis[vv] = false;
      r += dfs(vv);
    }
  }
  b[x] = r;
  return b[x];
}
int main() {
  cin >> n >> m;
  memset(ok, false, sizeof(ok));
  for (int i = 1; i <= m * 2; i++) {
    int x;
    scanf("%d", &x);
    ok[x] = true;
  }
  memset(vis, true, sizeof(vis));
  memset(b, -1, sizeof(b));
  for (int i = 1; i <= n; i++) v[i].clear();
  for (int i = 1; i < n; i++) {
    int uu, vv;
    scanf("%d%d", &uu, &vv);
    v[vv].push_back(uu);
    v[uu].push_back(vv);
  }
  vis[1] = false;
  dfs(1);
  long long int sum = 2 * m;
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    long long int z = b[i];
    long long int s = sum - b[i];
    ans += min(z, s);
  }
  printf("%lld\n", ans);
}
