#include <bits/stdc++.h>
using namespace std;
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline void Cin(T &x) {
  char c = getchar();
  x = 0;
  bool kt = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  if (kt) x = -x;
}
template <typename T, typename... Args>
inline void Cin(T &a, Args &...args) {
  Cin(a);
  Cin(args...);
}
const long long base = 1331;
const long long N = 2e5 + 5;
long long n, k;
long long s[N];
vector<long long> g[N];
long long res = 0;
void dfs(long long u, long long par) {
  for (auto &v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
    s[u] += s[v];
  }
  res += min(2 * k - s[u], s[u]);
}
void read(void) {
  cin >> n >> k;
  for (long long i = 1; i <= (long long)(2 * k); ++i) {
    long long x;
    cin >> x;
    s[x]++;
  }
  for (long long i = 1; i <= (long long)(n - 1); ++i) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  cout << res;
}
signed main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read();
}
