#include <bits/stdc++.h>
using namespace std;
template <typename T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(long long &x) { scanf("%" PRId64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <typename T, typename... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <typename T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
template <typename T>
void _W(const vector<T> &x) {
  for (auto i = x.cbegin(); i != x.cend(); i++) {
    if (i != x.cbegin()) putchar(' ');
    _W(*i);
  }
}
void W() {}
template <typename T, typename... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
const int N = 2e5 + 10;
int n, m, c[N], sc[N];
vector<int> e[N];
bool cmp_sc(int x, int y) { return sc[x] < sc[y]; }
int get_sc(int p, int f) {
  if (f != 0) e[p].erase(find(begin(e[p]), end(e[p]), f));
  sc[p] = c[p];
  for (int i : e[p]) sc[p] += get_sc(i, p);
  sort(begin(e[p]), end(e[p]), cmp_sc);
  return sc[p];
}
long long ans = 0;
void dfs(int p, int q) {
  if (e[p].empty()) return;
  int bk = e[p].back();
  if (q == -1 || 2 * sc[bk] <= q + sc[p]) {
    for (int i : e[p]) {
      ans += sc[i];
      dfs(i, -1);
    }
  } else {
    q += sc[p] - sc[bk];
    assert(q < sc[bk]);
    for (int i : e[p]) {
      if (i == bk) {
        ans += q;
        dfs(i, q);
      } else {
        ans += sc[i];
        dfs(i, -1);
      }
    }
  }
}
int main() {
  R(n, m);
  for (int i = 0; i < int(2 * m); i++) {
    int x;
    R(x);
    c[x] = 1;
  }
  for (int i = 0; i < int(n - 1); i++) {
    int a, b;
    R(a, b);
    e[a].push_back(b);
    e[b].push_back(a);
  }
  get_sc(1, 0);
  dfs(1, 0);
  W(ans);
  return 0;
}
