#include <bits/stdc++.h>
using namespace std;
void dfs(vector<long> adj[], bool vis[], long cnt[], int u[], long pos) {
  vis[pos] = true;
  cnt[pos] = u[pos];
  for (long i = 0; i < adj[pos].size(); i++) {
    if (!vis[adj[pos][i]]) {
      dfs(adj, vis, cnt, u, adj[pos][i]);
      cnt[pos] += cnt[adj[pos][i]];
    }
  }
  return;
}
int main() {
  long n, k, x, y;
  cin >> n >> k;
  int u[n + 1];
  memset(u, 0, sizeof(u));
  for (long i = 0; i < 2L * k; i++) {
    cin >> x;
    u[x] = 1;
  }
  long cnt[n + 1];
  vector<long> adj[n + 1];
  for (long i = 0; i < n - 1; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  bool vis[n + 1];
  memset(vis, false, sizeof(vis));
  dfs(adj, vis, cnt, u, 1L);
  long long sum = 0LL;
  for (long i = 2; i <= n; i++) {
    sum += min(cnt[i], 2L * k - cnt[i]);
  }
  cout << sum << endl;
}
