#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18 + 5;
int mod = (int)1e9 + 7;
const int logN = 16;
const int inf = 1e9 + 9;
const int N = 1e6 + 6;
int n, m, k, x, y, z, sum[N];
long long ans;
vector<int> v[N];
int dfs(int node, int root) {
  for (__typeof(v[node].begin()) it = v[node].begin(); it != v[node].end();
       it++)
    if (*it != root) sum[node] += dfs(*it, node);
  ans += min(k + k - sum[node], sum[node]);
  return sum[node];
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= k + k; i++) {
    scanf("%d", &x);
    sum[x]++;
  }
  for (int i = 2; i <= n; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1, 0);
  cout << ans << '\n';
  return 0;
}
