#include <bits/stdc++.h>
using namespace std;
long long INV2 = 500000004;
long long INV6 = 166666668;
long long power(long long a, long long b, long long c) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b & 1) x = (x * y) % c;
    y = (y * y) % c;
    b /= 2;
  }
  return x % c;
}
int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};
bool uni[200005];
long long l[200005];
vector<int> v[200005];
bool vis[200005];
void dfs(int i) {
  vis[i] = 1;
  long long cnt = 0;
  if (uni[i]) {
    l[i] = 1;
  }
  for (int j = 0; j < v[i].size(); ++j) {
    int idx = v[i][j];
    if (!vis[idx]) {
      dfs(idx);
      cnt += l[idx];
    }
  }
  l[i] += cnt;
}
int main() {
  int n, k;
  long long val;
  scanf("%d", &n), scanf("%d", &k);
  for (int i = 1; i <= 2 * k; ++i) {
    scanf("%lld", &val);
    uni[val] = 1;
  }
  int x, y;
  for (int i = 0; i < n - 1; ++i) {
    scanf("%d", &x), scanf("%d", &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1);
  long long cnt = 0;
  for (int i = 1; i <= n; ++i) {
    val = 2 * k - l[i];
    cnt += min(val, l[i]);
  }
  printf("%lld\n", cnt);
  return 0;
}
