#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N], n, k;
long long ans;
vector<int> adj[N];
int dfs(int v, int p) {
  int t = a[v];
  for (int u : adj[v]) {
    if (u == p) continue;
    int c = dfs(u, v);
    ans += min(c, 2 * k - c);
    t += c;
  }
  return t;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int u, v;
  cin >> n >> k;
  for (int i = 0; i < 2 * k; i++) cin >> u, a[u] = 1;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 0);
  cout << ans;
  return 0;
}
