#include <bits/stdc++.h>
using namespace std;
const int N = 200011;
int n, t;
long long int ans;
vector<int> gr[N];
bool sp[N];
int spc[N];
void dfs(int v, int p) {
  if (sp[v]) spc[v] = 1;
  for (int i = 0; i < (int)gr[v].size(); ++i) {
    int u = gr[v][i];
    if (u != p) {
      dfs(u, v);
      spc[v] += spc[u];
      if (spc[u] < t) ans += min(spc[u], t - spc[u]);
    }
  }
}
int main() {
  scanf("%d", &n);
  scanf("%d", &t);
  t *= 2;
  for (int i = 0; i < t; ++i) {
    int u;
    scanf("%d", &u);
    sp[u] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d", &u), scanf("%d", &v);
    gr[u].push_back(v);
    gr[v].push_back(u);
  }
  int st = 1;
  dfs(st, 0);
  printf("%lld\n", ans);
  return 0;
}
