#include <bits/stdc++.h>
using namespace std;
int n, k;
long long an;
bool un[200001];
vector<int> tr[200001];
int go(int v = 1, int p = -1) {
  int x = 0;
  for (int i = 0; i < tr[v].size(); ++i)
    if (tr[v][i] != p) {
      x += go(tr[v][i], v);
    }
  an += x;
  x += un[v];
  while (x > k) x -= 2, --k;
  return x;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < k << 1; ++i) {
    int t;
    scanf("%d", &t);
    un[t] = true;
  }
  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    tr[a].push_back(b);
    tr[b].push_back(a);
  }
  go();
  printf("%I64d", an);
}
