#include <bits/stdc++.h>
using namespace std;
void fileio() {}
template <typename T>
void swap(T& a, T& b) {
  T temp = a;
  a = b;
  b = temp;
}
const long long int N = 1000001;
vector<long long int>* edges;
vector<long long int> unis;
long long int ans;
void dfs(long long int a, long long int p) {
  for (long long int to : edges[a]) {
    if (to == p) continue;
    dfs(to, a);
    unis[a] += unis[to];
  }
}
void dfs2(long long int a, long long int p, long long int k) {
  for (long long int to : edges[a]) {
    if (to == p) continue;
    dfs2(to, a, k);
    ans += min(unis[to], 2 * k - unis[to]);
  }
}
void solve() {
  long long int n, k;
  cin >> n >> k;
  unis.assign(n, 0);
  edges = new vector<long long int>[n];
  for (long long int i = 0; i < 2 * k; i++) {
    long long int a;
    cin >> a;
    unis[a - 1]++;
  }
  for (long long int i = 1; i < n; i++) {
    long long int u, v;
    cin >> u >> v;
    edges[u - 1].push_back(v - 1);
    edges[v - 1].push_back(u - 1);
  }
  dfs(0, -1);
  ans = 0;
  dfs2(0, -1, k);
  cout << ans << endl;
}
int32_t main() {
  fileio();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  { solve(); }
  return 0;
}
