#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
bool u[N];
int r;
vector<int> e[N];
long long ans;
int dfs(int x, int lt) {
  int now = u[x];
  for (int i = 0; i < e[x].size(); i++) {
    int y = e[x][i];
    if (y == lt) continue;
    now += dfs(y, x);
  }
  while (now * 2 > r) {
    now -= 2;
    r -= 2;
  }
  ans += now;
  return now;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < k * 2; i++) {
    int x;
    scanf("%d", &x);
    u[x] = 1;
  }
  r = k * 2;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs(1, 1);
  printf("%lld\n", ans);
  return 0;
}
