#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, k;
vector<int> g[maxn];
bool is[maxn];
int st[maxn];
void dfs(int v, int p = -1) {
  st[v] = is[v];
  for (auto u : g[v])
    if (u != p) {
      dfs(u, v);
      st[v] += st[u];
    }
}
int we(int v, int u) {
  return min(min(st[u], st[v]), 2 * k - min(st[u], st[v]));
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= 2 * k; i++) {
    int v;
    cin >> v;
    is[v] = 1;
  }
  vector<pair<int, int>> edge;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    edge.push_back({u, v});
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1);
  long long ans = 0;
  for (auto e : edge) ans += we(e.first, e.second);
  cout << ans;
}
