#include <bits/stdc++.h>
using namespace std;
long long n, k;
map<long long, long long> mp;
vector<long long> v;
vector<vector<long long>> adj(200005);
void dfs(long long cur, long long p) {
  for (auto x : adj[cur]) {
    if (x != p) {
      dfs(x, cur);
      v[cur] += v[x];
    }
  }
  if (mp[cur]) v[cur]++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  v.resize(n + 1);
  for (long long i = 0; i < 2 * k; i++) {
    long long x;
    cin >> x;
    mp[x]++;
  }
  for (long long i = 1; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  k *= 2;
  dfs(1, -1);
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans += min(v[i], k - v[i]);
  cout << ans;
}
