#include <bits/stdc++.h>
using namespace std;
const int maxN(2e5 + 10);
typedef int i_N[maxN];
int N, K;
namespace graph {
i_N A, P, is_us, Cus, deg;
pair<int, int> edge[maxN];
vector<int> adj[maxN], node[maxN];
void link(const int u, const int v) { adj[u].push_back(v); }
void dfs(const int u) {
  for (int i = 0; i < (int)adj[u].size(); i++) {
    const int v(adj[u][i]);
    if (P[v]) continue;
    P[v] = u;
    dfs(v);
    Cus[u] += Cus[v];
  }
  Cus[u] += is_us[u];
}
}  // namespace graph
int main() {
  ios_base::sync_with_stdio(0);
  {
    using namespace graph;
    cin >> N >> K;
    for (int i = 0; i < K * 2; i++) cin >> A[i], is_us[A[i]] = 1;
    for (int i = 0; i < N - 1; i++) {
      int u, v;
      cin >> u >> v;
      edge[i] = pair<int, int>(u, v);
      link(u, v);
      link(v, u);
    }
  }
  {
    using namespace graph;
    P[1] = -1;
    dfs(1);
  }
  {
    using namespace graph;
    for (int i = 0; i < N - 1; i++) {
      const int v(P[edge[i].first] == edge[i].second ? edge[i].first
                                                     : edge[i].second);
      const int u(P[v]);
      if (Cus[v] && 2 * K - Cus[v]) deg[u]++, deg[v]++;
    }
    long long ans(0);
    queue<int> bfs_node;
    for (int u = 1; u <= N; u++)
      if (deg[u] == 1) node[1].push_back(u);
    for (int i = 1; i <= 2 * K; i++) {
      for (int j = 0; j < (int)node[i].size(); j++) {
        const int u(node[i][j]);
        deg[u] = 0;
        for (int k = 0; k < (int)adj[u].size(); k++) {
          const int v(adj[u][k]);
          if (!deg[v]) continue;
          ans += is_us[u];
          deg[v]--;
          is_us[v] += is_us[u];
          if (deg[v] == 1) node[is_us[v]].push_back(v);
        }
      }
    }
    cout << ans;
  }
}
