#include <bits/stdc++.h>
using namespace std;
int N, K, A[200005];
vector<int> tree[200005];
int cnt[200005];
long long sumDist[200005];
int depth;
void dfs(int n, int p) {
  for (int n2 : tree[n]) {
    if (n2 == p) continue;
    dfs(n2, n);
    cnt[n] += cnt[n2];
    sumDist[n] += sumDist[n2] + cnt[n2];
    if (cnt[n2] > K) {
      int unpaired = 2 * K - cnt[n2];
      sumDist[n] -= cnt[n2] - unpaired;
    }
  }
  cnt[n] += A[n];
}
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= 2 * K; i++) {
    int n;
    scanf("%d", &n);
    A[n] = 1;
  }
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  dfs(1, -1);
  cout << sumDist[1] << endl;
  return 0;
}
