#include <bits/stdc++.h>
using namespace std;
int mark[(int)2e5 + 1];
vector<int> adj[(int)2e5 + 1];
void dfs(int);
unsigned long long int ans = 0;
bool uni[(int)2e5 + 1];
int k;
int main() {
  int n;
  cin >> n >> k;
  int u[2 * k + 100];
  memset(uni, false, sizeof(uni));
  for (int i = 1; i <= 2 * k; i++) {
    cin >> u[i];
    uni[u[i]] = true;
  }
  int x, y;
  for (int i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  memset(mark, -1, sizeof(mark));
  dfs(1);
  cout << ans << endl;
  return 0;
}
void dfs(int v) {
  int u;
  mark[v] = uni[v];
  for (unsigned int i = 0; i < adj[v].size(); i++) {
    u = adj[v][i];
    if (mark[u] == -1) {
      dfs(u);
      mark[v] += mark[u];
    }
  }
  ans += min(mark[v], 2 * k - mark[v]);
}
