#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, a, b, x, child[N];
bool vis[N], univ[N];
vector<int> graph[N];
vector<pair<int, int> > edge;
long long ans;
int traverse(int pos) {
  if (univ[pos]) {
    child[pos] = 1;
  }
  for (int i = 0; i < graph[pos].size(); ++i) {
    if (vis[graph[pos][i]]) {
      continue;
    }
    vis[graph[pos][i]] = true;
    child[pos] += traverse(graph[pos][i]);
  }
  return child[pos];
}
int main() {
  scanf("%d %d", &n, &m);
  int special = m * 2;
  for (int i = 0; i < special; ++i) {
    scanf("%d", &x);
    univ[x] = true;
  }
  for (int i = 1; i < n; ++i) {
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
    edge.push_back(make_pair(a, b));
  }
  memset(vis, 0, sizeof(vis));
  memset(child, 0, sizeof(child));
  vis[1] = true;
  int dum = traverse(1);
  long long ans = 0;
  for (int i = 0; i < edge.size(); ++i) {
    int bottom = min(child[edge[i].first], child[edge[i].second]);
    ans += min(bottom, special - bottom);
  }
  printf("%I64d\n", ans);
  return 0;
}
