#include <bits/stdc++.h>
using namespace std;
long long n, k, coun = 0;
set<long long> ki;
vector<vector<long long> > adj(200006);
vector<long long> p(200008, 0);
vector<long long> vis(200008, 0);
vector<long long> svi(200008);
void parent(long long v, long long pi) {
  if (p[v] != 0) return;
  p[v] = pi;
  long long i, len = adj[v].size();
  for (i = 0; i < len; i++) parent(adj[v][i], v);
}
void sv(long long v) {
  if (vis[v] != 0) return;
  vis[v] = 1;
  long long oldc = coun;
  if (ki.find(v) != ki.end()) coun++;
  long long i, len = adj[v].size();
  for (i = 0; i < len; i++) sv(adj[v][i]);
  svi[v] = coun - oldc;
}
long long solve() {
  long long ans = 0;
  set<long long>::iterator it;
  vis.resize(0);
  vis.resize(200008);
  for (it = ki.begin(); it != ki.end(); it++) {
    long long val = *it;
    while (val != 1) {
      if (vis[val]) break;
      ans += min(svi[val], 2 * k - svi[val]);
      vis[val] = 1;
      val = p[val];
    }
  }
  return ans;
}
int main() {
  cin >> n >> k;
  for (long long i = 0; i < 2 * k; i++) {
    long long f;
    cin >> f;
    ki.insert(f);
  }
  for (long long i = 0; i < n - 1; i++) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  parent(1, 1);
  sv(1);
  long long ans = solve();
  cout << ans << "\n";
}
