#include <bits/stdc++.h>
using namespace std;
bool compare(pair<long long, long long> &i, pair<long long, long long> &j) {
  return i.second < j.second;
}
long long mod = 1e9 + 7;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long h = power(a, b / 2);
  h *= h;
  h %= mod;
  if (b % 2) h *= a;
  h %= mod;
  return h;
}
long long ans = 0;
long long k;
void dfs(vector<vector<long long>> &g, vector<long long> &uty,
         vector<long long> &vis, long long ind) {
  for (auto x : g[ind]) {
    if (!vis[x]) {
      vis[x] = 1;
      dfs(g, uty, vis, x);
      uty[ind] += uty[x];
    }
  }
  if (ind) ans += min(uty[ind], 2 * k - uty[ind]);
}
void solve() {
  long long n;
  cin >> n >> k;
  vector<long long> uty(n, 0);
  for (int i = 0; i < 2 * k; i++) {
    long long p;
    cin >> p;
    p--;
    uty[p] = 1;
  }
  vector<vector<long long>> g(n);
  for (int i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<long long> vis(n, 0);
  vis[0] = 1;
  dfs(g, uty, vis, 0);
  cout << ans << endl;
}
int main() {
  long long TC;
  TC = 1;
  while (TC--) {
    solve();
  }
  return 0;
}
