#include <bits/stdc++.h>
using namespace std;
void solve() {}
const long long maxn = 200500;
bool uni[maxn];
long long dp[maxn];
long long n, k;
vector<long long> G[maxn];
long long ans = 0;
long long dfs(long long v, long long par) {
  long long sum = uni[v];
  for (long long to : G[v]) {
    if (to == par) continue;
    sum += dfs(to, v);
  }
  if (par != -1) {
    ans += min(dp[v], 2 * k - dp[v]);
  }
  dp[v] = sum;
  return dp[v];
}
signed main() {
  ios::sync_with_stdio(0);
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 1; i <= 2 * k; i++) {
    long long x;
    cin >> x;
    uni[x] = true;
  }
  for (long long i = 1; i <= n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  dfs(1, -1);
  ans = 0;
  dfs(1, -1);
  cout << ans << '\n';
}
