#include <bits/stdc++.h>
using namespace std;
bool sp[200010];
int head[200010 * 2], last[200010 * 2], p[200010], e;
int num[200010], k;
long long ans;
int n;
void add(int x, int y) {
  head[++e] = y;
  last[e] = p[x];
  p[x] = e;
}
void dfs(int pre, int x) {
  num[x] = sp[x];
  for (int j = p[x]; j; j = last[j])
    if (head[j] != pre) {
      dfs(x, head[j]);
      num[x] += num[head[j]];
    }
  for (int j = p[x]; j; j = last[j])
    if (head[j] != pre) {
      ans += min(num[head[j]], k - num[head[j]]);
    }
}
int main() {
  scanf("%d%d", &n, &k);
  k *= 2;
  for (int i = 1; i <= k; i++) {
    int x;
    scanf("%d", &x);
    sp[x] = true;
  }
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(0, 1);
  cout << ans << endl;
}
