#include <bits/stdc++.h>
using namespace std;
void optimise() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long int mod = 998244353;
void normalize(long long int &a) { a = (a + mod) % mod; }
long long int modmul(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a * b) % mod;
}
long long int modadd(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a + b) % mod;
}
long long int modsub(long long int a, long long int b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a - b + mod) % mod;
}
long long int me(long long int x, long long int n) {
  x %= mod;
  if (n == 0) return 1;
  long long int u = me(x, n / 2) % mod;
  u = (u * u) % mod;
  if (n % 2) u = (u * x) % mod;
  return u;
}
long long int me1(long long int x, long long int n) {
  if (n == 0) return 1;
  long long int u = me1(x, n / 2);
  u = u * u;
  if (n % 2) u = u * x;
  return u;
}
inline long long int modInv(long long int a) { return me(a, mod - 2); }
inline long long int modDiv(long long int a, long long int b) {
  return modmul(a, modInv(b));
}
long long int __gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return __gcd(b, a % b);
}
const long long int N = 2e5 + 1;
vector<long long int> G[N];
vector<long long int> subtree(N);
vector<long long int> mark(N);
long long int ans = 0;
long long int k;
void dfs(long long int v, long long int par) {
  subtree[v] = mark[v];
  for (auto y : G[v]) {
    if (y == par) continue;
    dfs(y, v);
    subtree[v] += subtree[y];
  }
  ans += min(2 * k - subtree[v], subtree[v]);
}
void solve() {
  long long int n;
  cin >> n >> k;
  for (long long int i = 0; i < 2 * k; i++) {
    long long int x;
    cin >> x;
    mark[x] = 1;
  }
  for (long long int i = 0; i < n - 1; i++) {
    long long int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  dfs(1, 0);
  cout << ans;
}
signed main() {
  optimise();
  long long int t;
  t = 1;
  cout << fixed << setprecision(10);
  while (t--) {
    solve();
    cout << "\n";
  }
}
