#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
const int EPS = 1e-9;
const int MOD = 1000000007;
const char ENDL = '\n';
inline void JAM(int e) { cout << "Case #" << e << ": "; }
long long power(long long a, long long p) {
  if (p == 0)
    return 1;
  else if (p % 2 == 1)
    return a * power(a, p - 1);
  else {
    int b = power(a, p / 2);
    return b * b;
  }
}
const int maxn = 200002;
long long n, k;
bool uni[maxn];
long long uniNum[maxn];
long long uniDis[maxn];
vector<int> tree[maxn];
void countDisNum(int a, int o) {
  long long dis = 0;
  long long num = 0;
  for (int i = 0; i < ((int)(tree[a]).size()); i++)
    if (tree[a][i] != o) {
      countDisNum(tree[a][i], a);
      dis += uniDis[tree[a][i]];
      num += uniNum[tree[a][i]];
    }
  if (uni[a]) num++;
  uniNum[a] = num;
  uniDis[a] = dis + num;
}
long long anw;
void countAnw(int a, int o) {
  for (int i = 0; i < ((int)(tree[a]).size()); i++) {
    if (tree[a][i] != o) {
      if (uniNum[tree[a][i]] > (k / 2)) {
        anw += (k - uniNum[tree[a][i]]);
        countAnw(tree[a][i], a);
      } else
        anw += uniDis[tree[a][i]];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  k *= 2;
  for (int i = 0; i < k; i++) {
    int a;
    cin >> a;
    uni[a] = true;
  }
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  countDisNum(1, -1);
  countAnw(1, -1);
  cout << anw << ENDL;
}
