#include <bits/stdc++.h>
using namespace std;
long long ans;
struct Edge {
  int x, y, Link;
};
const int maxN = 200010;
Edge E[maxN * 2];
int Head[maxN], Len[maxN], Lab[maxN], cntC[maxN], maxC[maxN];
int k, n, sc;
bool ok;
void dfs2(int u) {
  ans = ans + Lab[u] * Len[u];
  int t = Head[u];
  while (t != 0) {
    int v = E[t].y;
    if (Len[v] == -1) {
      Len[v] = Len[u] + 1;
      dfs2(v);
    }
    t = E[t].Link;
  }
}
void dfs(int u) {
  if (ok) return;
  cntC[u] = Lab[u];
  int t = Head[u];
  while (t != 0) {
    int v = E[t].y;
    if (cntC[v] == -1) {
      dfs(v);
      cntC[u] += cntC[v];
      maxC[u] = max(maxC[u], cntC[v]);
    }
    t = E[t].Link;
  }
  if (cntC[u] >= k / 2 && maxC[u] <= k / 2) {
    ok = true;
    Len[u] = 0;
    dfs2(u);
  }
}
void addE(int x, int y) {
  sc++;
  E[sc].x = x;
  E[sc].y = y;
  E[sc].Link = Head[x];
  Head[x] = sc;
}
int main() {
  cin >> n >> k;
  k *= 2;
  for (int i = 1; i <= n; i++) Lab[i] = 0;
  for (int i = 1; i <= k; i++) {
    int t;
    cin >> t;
    Lab[t] = 1;
  }
  for (int i = 1; i <= n; i++) Head[i] = 0;
  sc = 0;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    addE(x, y);
    addE(y, x);
  }
  for (int i = 1; i <= n; i++) {
    cntC[i] = -1;
    maxC[i] = -1;
    Len[i] = -1;
  }
  ok = false;
  dfs(1);
  cout << ans;
}
