#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
vector<int> a[N];
bool uni[N];
int n, k;
long long ans;
int sonNum[N];
void dfs(int u, int p) {
  for (int i = 0; i < a[u].size(); i++) {
    int v = a[u][i];
    if (v == p) continue;
    dfs(v, u);
    sonNum[u] += sonNum[v];
  }
  if (uni[u]) sonNum[u]++;
  ans += min(2 * k - sonNum[u], sonNum[u]);
}
int main() {
  cin >> n >> k;
  ans = 0;
  memset(uni, 0, sizeof(uni));
  for (int i = 0; i < 2 * k; i++) {
    int tmp;
    cin >> tmp;
    uni[tmp] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(v);
    a[v].push_back(u);
  }
  memset(sonNum, 0, sizeof(sonNum));
  dfs(1, 0);
  cout << ans << endl;
  return 0;
}
