#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int n, k, Fa[N], C[N], D[N];
vector<int> Adj[N];
void DFS(int u, int root) {
  Fa[u] = root;
  D[u] = C[u];
  for (int i = 0; i < Adj[u].size(); i++) {
    int v = Adj[u][i];
    if (v == root) continue;
    DFS(v, u);
    D[u] += D[v];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  memset(C, sizeof(C), 0);
  for (int i = 0; i < 2 * k; i++) {
    int x;
    cin >> x;
    C[x]++;
  }
  for (int i = 1; i <= n; i++) Adj[i].clear();
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    Adj[u].push_back(v);
    Adj[v].push_back(u);
  }
  DFS(1, 0);
  long long ans = 0;
  for (int i = 2; i <= n; i++) ans += min(D[i], 2 * k - D[i]);
  cout << ans;
  return 0;
}
