#include <bits/stdc++.h>
#pragma GCC optimaze("Ofast");
#pragma GCC optimize("unroll-loops")
using namespace std;
const int maxn = 2e5 + 113;
vector<int> gr[maxn];
int sized[maxn];
bool used[maxn];
long long ans = 0;
int dfs(int v) {
  used[v] = 1;
  for (int to : gr[v])
    if (!used[to]) sized[v] += dfs(to);
  return sized[v];
}
void dfs2(int v, int k) {
  used[v] = 1;
  for (int to : gr[v])
    if (!used[to]) {
      ans += min(sized[to], 2 * k - sized[to]);
      dfs2(to, k);
    }
}
signed main() {
  srand(1);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.setf(ios::fixed);
  cout.precision(10);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < 2 * k; i++) {
    int a;
    cin >> a;
    sized[a]++;
  }
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    gr[a].push_back(b);
    gr[b].push_back(a);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) used[i] = 0;
  dfs2(1, k);
  cout << ans;
}
