#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int n, k;
const int MAXN = 2e5 + 5;
bool univ[MAXN] = {0};
list<int> g[MAXN];
pair<long long, long long> dfs(int u, int p = -1) {
  pair<long long, long long> ans(0, 0);
  for (auto v : g[u])
    if (v != p) {
      pair<long long, long long> temp = dfs(v, u);
      ans.first += temp.first;
      ans.second += temp.second + temp.first;
    }
  if (univ[u]) ans.first++;
  while (ans.first > k) {
    ans.first -= 2;
    k--;
  }
  return ans;
}
void solve() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < 2 * k; ++i) {
    int u;
    scanf("%d", &u);
    univ[u - 1] = true;
  }
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  pair<long long, long long> ans = dfs(0);
  cout << ans.second << endl;
}
int main() {
  solve();
  return 0;
}
