#include <bits/stdc++.h>
using namespace std;
int N, K, open[200020];
long long ANS;
bool hastown[200020];
struct el {
  el* next;
  int val;
  el(el* next, int val) {
    this->next = next;
    this->val = val;
  }
} * adj[200020];
void Read() {
  int from, to, tmp;
  cin >> N >> K;
  for (int i = 1; i <= 2 * K; ++i) {
    cin >> tmp;
    hastown[tmp] = true;
  }
  for (int i = 1; i < N; ++i) {
    scanf("%d %d", &from, &to);
    adj[from] = new el(adj[from], to);
    adj[to] = new el(adj[to], from);
  }
}
pair<long long, long long> findDist(int now, int par) {
  pair<long long, long long> out = make_pair(0, 0), tmp;
  for (el* nxt = adj[now]; nxt; nxt = nxt->next) {
    if (nxt->val == par) continue;
    tmp = findDist(nxt->val, now);
    out.first += tmp.first;
    out.second += tmp.second;
  }
  out.second += out.first;
  if (hastown[now]) ++out.first;
  open[now] = out.first;
  return out;
}
void Dfs(int now, int par, int up = 0) {
  int mx = 0;
  if (par != 0) ANS -= (open[now] - up);
  el* mxpos = NULL;
  for (el* nxt = adj[now]; nxt; nxt = nxt->next) {
    if (nxt->val == par) continue;
    if (mx < open[nxt->val]) {
      mx = open[nxt->val];
      mxpos = nxt;
    }
  }
  if ((mx - up) <= (open[now] - mx)) return;
  Dfs(mxpos->val, now, mx - (mx - up) + (open[now] - mx));
}
void Solve() {
  ANS = findDist(1, 0).second;
  Dfs(1, 0);
  cout << ANS << "\n";
}
int main() {
  Read();
  Solve();
  return 0;
}
