#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int vis[maxn];
int n, k;
vector<int> gra[maxn];
int dan[maxn];
int cnt[maxn];
long long ans;
int dfs(int x) {
  int sum = (dan[x] == 1);
  vis[x] = 1;
  for (int i = 0; i < gra[x].size(); i++) {
    if (!vis[gra[x][i]]) {
      int temp = dfs(gra[x][i]);
      sum += temp;
      if (temp == 2 * k || temp == 0)
        continue;
      else
        ans += min(temp, 2 * k - temp);
    }
  }
  return sum;
}
int main() {
  scanf("%d %d", &n, &k);
  memset(dan, 0, sizeof(dan));
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= 2 * k; i++) {
    int a;
    scanf("%d", &a);
    dan[a] = 1;
  }
  for (int i = 1; i < n; i++) {
    int from, to;
    scanf("%d %d", &from, &to);
    gra[from].push_back(to);
    gra[to].push_back(from);
  }
  ans = 0;
  dfs(1);
  printf("%I64d\n", ans);
  return 0;
}
