#include <bits/stdc++.h>
using namespace std;
long long n, k, v[200005] = {0}, val[200005] = {0}, first, second, i, ans = 0,
                root = -1, j, p[200005] = {0}, f, s;
vector<long long> a[200005];
void dfs(long long node, long long par) {
  long long i;
  p[node] = par;
  for (i = 0; i < a[node].size(); ++i)
    if (a[node][i] != par) {
      dfs(a[node][i], node);
      val[node] += val[a[node][i]];
    }
  val[node] += v[node];
}
void dfs1(long long node, long long par, long long dist) {
  long long i;
  if (v[node]) ans += dist;
  for (i = 0; i < a[node].size(); ++i)
    if (a[node][i] != par) dfs1(a[node][i], node, dist + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (i = 0; i < 2 * k; ++i) {
    cin >> first;
    v[first] = 1;
  }
  for (i = 0; i < n - 1; ++i) {
    cin >> first >> second;
    a[first].push_back(second);
    a[second].push_back(first);
  }
  dfs(1, -1);
  for (i = 1; i <= n; ++i) {
    f = 1;
    s = 0;
    for (j = 0; j < a[i].size(); ++j)
      if (a[i][j] != p[i] && val[a[i][j]] > k) {
        f = 0;
        break;
      } else if (a[i][j] != p[i])
        s += val[a[i][j]];
    if (s < k) f = 0;
    if (f) break;
  }
  root = i;
  dfs1(root, -1, 0);
  cout << ans;
  return 0;
}
