#include <bits/stdc++.h>
using namespace std;
int lst[200005], nxt[400005], to[400005], tol;
int sz[200005], f[200005];
long long dp[200005];
int vis[200005];
int qu[200005];
int N, K;
void adde(int u, int v) {
  nxt[tol] = lst[u];
  to[tol] = v;
  lst[u] = tol;
  ++tol;
}
void solve() {
  cin >> N >> K;
  memset(lst, 0xff, sizeof(lst));
  tol = 0;
  memset(sz, 0, sizeof(sz));
  for (int i = 0; i < (K * 2); ++i) {
    int u;
    scanf("%d", &u);
    sz[u] = 1;
  }
  for (int i = 0; i < (N - 1); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    adde(u, v);
    adde(v, u);
  }
  memset(vis, 0, sizeof(vis));
  memset(dp, 0, sizeof(dp));
  int tail = 0;
  f[1] = 0;
  vis[1] = 1;
  qu[tail++] = 1;
  for (int i = 0; i < (tail); ++i) {
    int u = qu[i];
    for (int p = lst[u]; p != -1; p = nxt[p]) {
      int v = to[p];
      if (!vis[v]) {
        vis[v] = 1;
        f[v] = u;
        qu[tail++] = v;
      }
    }
  }
  for (int i = tail - 1; i >= 0; --i) {
    int u = qu[i];
    dp[u] += min(sz[u], 2 * K - sz[u]);
    sz[f[u]] += sz[u];
    dp[f[u]] += dp[u];
  }
  cout << dp[1] << endl;
}
int main() {
  solve();
  return 0;
}
