#include <bits/stdc++.h>
using namespace std;
bool hu[200200];
int n, k, K;
long long ans;
vector<int> g[200200];
int dfs(int p, int u) {
  int cnt = hu[u], tmp;
  for (auto v : g[u])
    if (v != p) {
      tmp = dfs(u, v);
      ans += tmp;
      cnt += tmp;
      while (cnt > k) {
        cnt -= 2;
        K -= 2;
        --k;
      }
    }
  if (cnt == K) return 0;
  return cnt;
}
int main() {
  scanf("%d%d", &n, &k);
  K = k << 1;
  for (int i = 0, u; i < K; ++i) {
    scanf("%d", &u);
    hu[u] = true;
  }
  for (int i = 0, u, v; i < n - 1; ++i) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, 1);
  printf("%I64d\n", ans);
}
