#include <bits/stdc++.h>
using namespace std;
struct E {
  int to, nxt;
} b[400005];
int fst[200005], tot;
void insert(int f, int t) {
  b[++tot] = (E){t, fst[f]};
  fst[f] = tot;
  b[++tot] = (E){f, fst[t]};
  fst[t] = tot;
}
int deep[200005];
long long m, ans, sz[200005];
bool use[200005];
void dfs(int x) {
  if (use[x]) sz[x] = 1;
  for (int i = fst[x]; i; i = b[i].nxt) {
    int v = b[i].to;
    if (!deep[v]) {
      deep[v] = deep[x] + 1;
      dfs(v);
      sz[x] += sz[v];
    }
  }
  while (sz[x] > m / 2) {
    sz[x] -= 2;
    m -= 2;
  }
  ans += sz[x];
}
int main() {
  int n, x;
  cin >> n >> m;
  m *= 2;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &x);
    use[x] = 1;
  }
  int y;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    insert(x, y);
  }
  deep[1] = 1;
  dfs(1);
  cout << ans << endl;
}
