#include <bits/stdc++.h>
using namespace std;
long long int prod(long long int a, long long int b) {
  long long int x, d;
  if (b == 0)
    return 1;
  else {
    d = prod(a, b / 2);
    x = (d * d) % 1000000007;
    if (b % 2 == 0)
      return x;
    else
      return (x * (a % 1000000007)) % 1000000007;
  }
}
long long int a[200005], size[200005];
vector<long long int> v[200005];
long long int dfs(long long int i, long long int p) {
  long long int cnt = 0, j;
  if (a[i]) cnt++;
  for (j = 0; j < v[i].size(); j++) {
    if (v[i][j] != p) cnt += dfs(v[i][j], i);
  }
  size[i] = cnt;
  return cnt;
}
int main() {
  long long int n, k, i, j, z, b, x;
  scanf("%lld", &n), scanf("%lld", &k);
  for (i = 0; i < n + 5; i++) {
    a[i] = 0;
    size[i] = 0;
  }
  for (i = 0; i < 2 * k; i++) scanf("%lld", &x), a[x] = 1;
  for (i = 0; i < n - 1; i++)
    scanf("%lld", &z), scanf("%lld", &b), v[z].push_back(b), v[b].push_back(z);
  dfs(1, -1);
  long long int ans = 0;
  for (i = 0; i < n + 1; i++) {
    ans += min(size[i], 2 * k - size[i]);
  }
  cout << ans << endl;
  return 0;
}
