#include <bits/stdc++.h>
using namespace std;
const double g = 10.0, eps = 1e-5;
const int N = 200000 + 7, maxn = 1200000 + 10, inf = 0x3f3f3f3f,
          INF = 0x3f3f3f3f3f3f3f3f;
bool vis[N];
vector<int> v[N];
int sz[N], n, k;
void dfssz(int u, int fa) {
  if (vis[u])
    sz[u] = 1;
  else
    sz[u] = 0;
  for (int i = 0; i < v[u].size(); i++) {
    int x = v[u][i];
    if (x != fa) {
      dfssz(x, u);
      sz[u] += sz[x];
    }
  }
}
void dfs(int u, int fa, long long &ans) {
  for (int i = 0; i < v[u].size(); i++) {
    int x = v[u][i];
    if (x != fa) {
      ans += min(2 * k - sz[x], sz[x]);
      dfs(x, u, ans);
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= 2 * k; i++) {
    int x;
    scanf("%d", &x);
    vis[x] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    v[a].push_back(b), v[b].push_back(a);
  }
  dfssz(1, -1);
  long long ans = 0;
  dfs(1, -1, ans);
  printf("%lld\n", ans);
  return 0;
}
