#include <bits/stdc++.h>
using namespace std;
constexpr long long maxn = 2e5 + 5, inf = 0x3f3f3f3f;
vector<long long> e[maxn];
long long n, m, k, c[maxn], ans;
void dfs(long long u, long long fa) {
  for (auto v : e[u]) {
    if (v == fa) continue;
    dfs(v, u);
    c[u] += c[v];
    ans += min(c[v], k - c[v]);
  }
}
signed main() {
  cin >> n >> k;
  k *= 2;
  for (long long i = 1; i <= k; i++) {
    long long x;
    cin >> x;
    c[x] = 1;
  }
  for (long long i = 1; i < n; i++) {
    long long u, v;
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  dfs(1, 1);
  cout << ans;
}
