#include <bits/stdc++.h>
using namespace std;
const int INF = numeric_limits<int>::max();
inline int pow2(int k) { return 1 << k; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  scanf("%d %d", &n, &k);
  vector<bool> uni(n, false);
  vector<vector<int>> nb(n, vector<int>());
  for (int i = 0; i < 2 * k; i++) {
    int v;
    scanf("%d", &v);
    v--;
    uni[v] = true;
  }
  for (int i = 0; i < n - 1; i++) {
    int v1, v2;
    scanf("%d %d", &v1, &v2);
    v1--;
    v2--;
    nb[v1].push_back(v2);
    nb[v2].push_back(v1);
  }
  vector<long long> cnt(n, 0);
  vector<int> go;
  int v;
  vector<int> par(n, -1);
  go.assign(n, 0);
  v = 0;
  while (1) {
    if (go[v] < nb[v].size()) {
      int nxt = go[v]++;
      int newv = nb[v][nxt];
      if (par[v] == newv) {
        continue;
      } else {
        par[newv] = v;
        v = newv;
      }
    } else {
      if (uni[v]) cnt[v]++;
      int p = par[v];
      if (p == -1) break;
      cnt[p] += cnt[v];
      v = p;
    }
  }
  long long res = 0;
  long long all = cnt[0];
  go.assign(n, 0);
  v = 0;
  while (1) {
    if (go[v] < nb[v].size()) {
      int nxt = go[v]++;
      int newv = nb[v][nxt];
      if (par[v] == newv) {
        continue;
      } else {
        v = newv;
      }
    } else {
      res += min(cnt[v], all - cnt[v]);
      int p = par[v];
      if (p == -1) break;
      v = p;
    }
  }
  printf("%lld\n", res);
  return 0;
}
