#include <bits/stdc++.h>
using namespace std;
long long int n, k, d[200005], u[200005], par[200005];
bool mark[200005];
vector<long long int> adj[200005];
long long int ans = 0;
void dfs(long long int i, long long int p) {
  par[i] = p;
  if (mark[i]) d[i] = 1;
  for (auto j : adj[i]) {
    if (j != p) dfs(j, i), d[i] += d[j];
  }
}
void dfs1(long long int i, long long int p) {
  if (i != 1) u[i] = d[p] - d[i] + u[p];
  for (auto j : adj[i]) {
    if (j != p) dfs1(j, i);
  }
}
void dfs3(long long int i, long long int p, long long int l) {
  if (mark[i]) ans += l;
  for (auto j : adj[i]) {
    if (j != p) dfs3(j, i, l + 1);
  }
}
int main() {
  scanf("%lld", &n);
  scanf("%lld", &k);
  for (int i = 1; i <= 2 * k; i++) {
    long long int x;
    scanf("%lld", &x);
    mark[x] = true;
  }
  for (int i = 1; i < n; i++) {
    long long int x, y;
    scanf("%lld", &x);
    scanf("%lld", &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1, 1);
  dfs1(1, 1);
  long long int x = 1;
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += min(d[i], 2 * k - d[i]);
  }
  printf("%lld\n", ans);
  return 0;
}
