#include <bits/stdc++.h>
using namespace std;
int n, k;
void dfs(int v, vector<bool> &visited, vector<bool> &mark, vector<int> &count,
         vector<vector<int> > &adj) {
  visited[v] = true;
  for (int i = 0; i < adj[v].size(); i++) {
    if (!visited[adj[v][i]]) {
      dfs(adj[v][i], visited, mark, count, adj);
      count[v] += count[adj[v][i]];
    }
  }
  if (mark[v] == true) count[v]++;
}
int main(void) {
  int i, j, a, b;
  cin >> n >> k;
  vector<bool> mark(n + 1, false);
  vector<bool> visited(n + 1, false);
  vector<int> count(n + 1, 0);
  for (i = 0; i < 2 * k; i++) {
    cin >> j;
    mark[j] = true;
  }
  vector<vector<int> > adj(n + 1);
  for (i = 1; i < n; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1, visited, mark, count, adj);
  long long int sum = 0;
  for (i = 1; i <= n; i++) sum += min(count[i], (2 * k) - count[i]);
  cout << sum;
}
