#include <bits/stdc++.h>
using namespace std;
int n, k;
list<int> L[210000];
set<int> S[210000];
int uni[210000];
int v[210000];
int dep[210000];
int usum[210000];
int ord[210000];
int ind;
void dfs(int x) {
  for (int y : L[x])
    if (v[y] == 0) {
      v[y] = x;
      dfs(y);
    }
  ord[ind++] = x;
}
int main() {
  scanf("%d%d", &n, &k);
  int a, b;
  for (int i = 0; i < 2 * k; ++i) {
    scanf("%d", &a);
    uni[a] = 1;
    usum[a] = 1;
  }
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a, &b);
    L[a].push_back(b);
    L[b].push_back(a);
  }
  v[1] = 1;
  dfs(1);
  long long res = 0;
  int cnt = 0;
  for (int i = 0; i < ind; ++i) {
    int c = ord[i];
    uni[c] = min(uni[c], 2 * k - usum[c]);
    res += uni[c];
    uni[v[c]] += uni[c];
    usum[v[c]] += usum[c];
  }
  printf("%lld\n", res);
  return 0;
}
