#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  int m = 1;
  for (int i = 0; i < m; i++) {
    solve();
  }
  return 0;
}
long long INF = INT64_MAX;
long long mod = 1000000007LL;
vector<vector<long long> > g;
vector<long long> used;
set<long long> univ;
vector<long long> kol_univ;
long long dfs(long long v) {
  used[v] = true;
  long long ans = 0;
  if (univ.find(v) != univ.end()) {
    ans++;
  }
  for (long long i = 0; i < g[v].size(); i++) {
    long long to = g[v][i];
    if (!used[to]) {
      ans += dfs(to);
    }
  }
  kol_univ[v] = ans;
  return ans;
}
long long res = 0;
void dfs2(long long v, long long from_p = 0) {
  used[v] = true;
  for (long long i = 0; i < g[v].size(); i++) {
    long long to = g[v][i];
    if (!used[to]) {
      if (kol_univ[to] <= kol_univ[v] - kol_univ[to] + from_p) {
        res += kol_univ[to];
        dfs2(to, kol_univ[to]);
      } else {
        res += kol_univ[v] - kol_univ[to] + from_p;
        dfs2(to, kol_univ[v] - kol_univ[to] + from_p);
      }
    }
  }
}
void solve() {
  long long n, k;
  cin >> n >> k;
  g.resize(n);
  kol_univ.resize(n);
  used.resize(n, false);
  for (long long i = 0; i < 2 * k; i++) {
    long long r;
    cin >> r;
    univ.insert(r - 1);
  }
  for (long long i = 0; i < n - 1; i++) {
    long long v1, v2;
    cin >> v1 >> v2;
    v1--;
    v2--;
    g[v1].push_back(v2);
    g[v2].push_back(v1);
  }
  dfs(0);
  used.assign(n, false);
  dfs2(0);
  cout << res;
}
