#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const long long LINF = 1e18;
long long n, k;
vector<vector<int>> g;
vector<long long> dp;
long long ans;
vector<bool> used;
void dfs(int v) {
  used[v] = true;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (used[to]) {
      continue;
    }
    dfs(to);
    dp[v] += dp[to];
  }
  ans += min(dp[v], 2 * k - dp[v]);
}
int main() {
  cin >> n >> k;
  g.resize(n);
  dp.assign(n, 0);
  for (int i = 0; i < 2 * k; ++i) {
    int v;
    cin >> v;
    --v;
    ++dp[v];
  }
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  ans = 0;
  used.assign(n, false);
  dfs(0);
  cout << ans;
  return 0;
}
