#include <bits/stdc++.h>
using namespace std;
int town[200000 + 1], n, k, u, v;
vector<vector<int>> adjlist;
long long len;
void dfs(int cur, int parent) {
  for (int i = 0; i < adjlist[cur].size(); i++) {
    if (parent == adjlist[cur][i]) continue;
    dfs(adjlist[cur][i], cur);
    town[cur] += town[adjlist[cur][i]];
  }
  len += min(town[cur], 2 * k - town[cur]);
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= 2 * k; i++) {
    int x;
    cin >> x;
    town[x]++;
  }
  adjlist.resize(n + 1);
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    adjlist[u].push_back(v);
    adjlist[v].push_back(u);
  }
  dfs(1, 0);
  cout << len;
}
