#include <bits/stdc++.h>
using namespace std;
void my_dbg() { cout << endl; }
template <typename Arg, typename... Args>
void my_dbg(Arg A, Args... B) {
  cout << ' ' << A;
  my_dbg(B...);
}
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9 + 7;
const int maxN = 1e6 + 2;
vi adj[maxN];
int subtree[maxN], mark[maxN];
int k;
ll ans;
void dfs(int node, int par = -1) {
  subtree[node] = mark[node];
  for (int it : adj[node]) {
    if (it != par) {
      dfs(it, node);
      subtree[node] += subtree[it];
    }
  }
  ans += min(subtree[node], 2 * k - subtree[node]);
}
int main() {
  int n;
  scanf("%d", &n);
  scanf("%d", &k);
  for (int i = 0; i < (int)2 * k; i++) {
    int hasUni;
    scanf("%d", &hasUni);
    mark[hasUni] = 1;
  }
  for (int i = 0; i < (int)n - 1; i++) {
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1);
  printf("%lld\n", ans);
  return 0;
}
