#include <bits/stdc++.h>
using namespace ::std;
const int N = 200005;
int n, k;
long long ans;
int cnt[N + 5];
int all_cnt[N + 5];
vector<int> ad[N + 5];
bool visited[N + 5];
void dfs(int now) {
  visited[now] = true;
  all_cnt[now] = cnt[now];
  for (int i = 0; i < ad[now].size(); i++) {
    int next = ad[now][i];
    if (!visited[next]) {
      dfs(next);
      all_cnt[now] += all_cnt[next];
    }
  }
  if (now != 1) ans += min(all_cnt[now], 2 * k - all_cnt[now]);
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < 2 * k; i++) {
    int v;
    scanf("%d", &v);
    cnt[v]++;
  }
  for (int i = 1; i < n; i++) {
    int v1, v2;
    scanf("%d %d", &v1, &v2);
    ad[v1].push_back(v2);
    ad[v2].push_back(v1);
  }
  dfs(1);
  printf("%lld", ans);
  return 0;
}
