#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int M = 1e6 + 10;
const int MOD = 1e9 + 7;
double const pi = acos(-1);
const double eps = 1e-8;
void fre() { freopen("in.txt", "r", stdin); }
int a[N];
vector<int> s[N];
int n, k;
long long ans;
void dfs(int u, int f) {
  for (int i = 0; i < (int)s[u].size(); i++) {
    int v = s[u][i];
    if (v == f) continue;
    dfs(v, u);
    a[u] += a[v];
    ans += min(a[v], 2 * k - a[v]);
  }
  return;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < 2 * k; i++) {
    int x;
    scanf("%d", &x);
    a[x] = 1;
  }
  for (int i = 0; i <= n; i++) s[i].clear();
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    s[x].push_back(y);
    s[y].push_back(x);
  }
  ans = 0;
  dfs(1, -1);
  printf("%I64d\n", ans);
  return 0;
}
