#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 20, M = 1e2 + 10, mod = 1e9 + 7, inf = 1e9 + 1000;
long long ans;
int vis[N], bo[N], n, k;
vector<int> G[N];
void dfs(int u, int fa) {
  vis[u] = bo[u];
  for (int i = 0; i < G[u].size(); i++) {
    int to = G[u][i];
    if (to == fa) continue;
    dfs(to, u);
    vis[u] += vis[to];
  }
}
void dfs2(int u, int fa, int dep) {
  for (int i = 0; i < G[u].size(); i++) {
    int to = G[u][i];
    if (to == fa) continue;
    dfs2(to, u, dep + bo[to]);
    ans += min(vis[to], 2 * k - vis[to]);
  }
}
int main() {
  int x;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= k * 2; i += 1) scanf("%d", &x), bo[x] = 1;
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(1, -1);
  dfs2(1, -1, bo[1]);
  printf("%I64d\n", ans);
}
