#include <bits/stdc++.h>
using namespace std;
long long res;
vector<int> g[(1 << 18)];
int n, k, x, y, f[(1 << 18)];
void dfs(int u, int fa) {
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v != fa) dfs(v, u), f[u] += f[v], res += min(f[v], k - f[v]);
  }
}
int main() {
  cin >> n >> k, k += k;
  for (int i = 0; i < k; i++) scanf("%d", &x), f[x] = 1;
  for (int i = 1; i < n; i++)
    scanf("%d%d", &x, &y), g[x].push_back(y), g[y].push_back(x);
  dfs(1, 1), cout << res << endl;
  return 0;
}
