#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> G[300000];
int U[300000];
pair<int, long long> T[300000];
int my_vertex;
pair<int, long long> dfs(int v, int u) {
  pair<int, long long> total = make_pair(0, 0);
  long long mv = 0;
  for (int i = 0; i < G[v].size(); ++i) {
    if (G[v][i] != u) {
      pair<int, long long> ret = dfs(G[v][i], v);
      total.first += ret.first;
      total.second += ret.second + ret.first;
      if (mv < ret.first) mv = ret.first;
    }
  }
  if (U[v]) ++total.first;
  if (mv <= k && total.first >= k && my_vertex == -1) {
    my_vertex = v;
  }
  T[v] = total;
  return total;
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; ++i) U[i] = 0;
  for (int i = 0; i < 2 * k; ++i) {
    int x;
    scanf("%d", &x);
    U[x - 1] = 1;
  }
  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a;
    --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  my_vertex = -1;
  dfs(0, 0);
  dfs(my_vertex, my_vertex);
  printf("%I64d\n", T[my_vertex].second);
  return 0;
}
