#include <bits/stdc++.h>
using namespace std;
long long k, ans = 0;
vector<long long> v[200005], un(200005), sub(200005);
void dfs(long long x, long long p) {
  if (v[x].size() == 1 && x != 1) {
    if (un[x]) sub[x] = 1;
    return;
  }
  for (auto i : v[x]) {
    if (i == p) continue;
    dfs(i, x);
    sub[x] += sub[i];
    ans += min(sub[i], 2 * k - sub[i]);
  }
  if (un[x]) sub[x]++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1, i, j, n, m, a, b;
  while (t--) {
    cin >> n >> k;
    for (i = 0; i < 2 * k; i++) {
      cin >> a;
      un[a] = 1;
    }
    for (i = 0; i < n - 1; i++) {
      cin >> a >> b;
      v[a].push_back(b);
      v[b].push_back(a);
    }
    dfs(1, -1);
    cout << ans;
  }
}
