#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  char c = getchar();
  long long w = 1;
  x = 0;
  while (!isdigit(c)) (c == '-') && (w = -w), c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
  x *= w;
}
template <typename T>
inline void print(T k, char ch = 0) {
  if (k < 0) putchar('-'), k = -k;
  if (k > 9) print(k / 10, 0);
  putchar(k % 10 + '0');
  if (ch) putchar(ch);
}
const long long N = 200010;
long long n, k, x, u, v, ans = 0, f[N];
vector<long long> G[N];
inline void dfs(long long x, long long fa) {
  for (register long long i = 0; i < G[x].size(); ++i) {
    long long to = G[x][i];
    if (to == fa) continue;
    dfs(to, x);
    f[x] += f[to];
    ans += min(f[to], k - f[to]);
  }
}
signed main() {
  read(n);
  read(k);
  k <<= 1;
  for (register long long i = 1; i <= k; ++i) read(x), f[x] = 1;
  for (register long long i = 1; i < n; ++i) {
    read(u);
    read(v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(1, 0);
  cout << ans;
  getchar();
  return 0;
}
