#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-4;
const long long mod = 1e9 + 7;
const unsigned long long mx = 133333331;
inline void RI(int &x) {
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';
}
int vis[200005];
vector<int> v[200005];
int num[200005];
long long ans;
int k;
void dfs1(int u, int fa) {
  if (vis[u]) num[u] = 1;
  for (int i = 0; i < v[u].size(); i++) {
    int vv = v[u][i];
    if (vv != fa) {
      dfs1(vv, u);
      num[u] += num[vv];
    }
  }
}
void dfs2(int u, int fa) {
  for (int i = 0; i < v[u].size(); i++) {
    int vv = v[u][i];
    if (vv != fa) {
      ans += min(num[vv], 2 * k - num[vv]);
      dfs2(vv, u);
    }
  }
}
int main() {
  int n;
  while (cin >> n >> k) {
    memset(vis, 0, sizeof(vis));
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) v[i].clear();
    for (int i = 0; i < 2 * k; i++) {
      int a;
      scanf("%d", &a);
      vis[a] = 1;
    }
    for (int i = 1; i < n; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      v[a].push_back(b);
      v[b].push_back(a);
    }
    ans = 0;
    dfs1(1, -1);
    dfs2(1, -1);
    cout << ans << endl;
  }
  return 0;
}
