#include <bits/stdc++.h>
using namespace std;
long long n, k, ans = 0;
vector<long long> edge[200001];
vector<long long> cnt(200001, 0);
void dfs(long long rt, long long parent) {
  for (long long i = 0; i < edge[rt].size(); ++i) {
    if (edge[rt][i] == parent) continue;
    dfs(edge[rt][i], rt);
    cnt[rt] += cnt[edge[rt][i]];
    ans += min(cnt[edge[rt][i]], 2 * k - cnt[edge[rt][i]]);
  }
}
int main() {
  scanf("%lld %lld", &n, &k);
  for (long long i = 0; i < 2 * k; ++i) {
    long long u;
    scanf("%lld", &u);
    ++cnt[u];
  }
  for (long long i = 0; i < n - 1; ++i) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    edge[x].push_back(y);
    edge[y].push_back(x);
  }
  dfs(1, -1);
  printf("%lld\n", ans);
}
