#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
vector<int> a[MAXN];
int b[MAXN];
long long ans;
int n, k;
int temp;
void dfs(int x, int start) {
  for (int i = a[x].size() - 1; i != -1; i--) {
    int y = a[x][i];
    if (y == start) continue;
    dfs(y, x);
    ans += min(b[y], 2 * k - b[y]);
    b[x] += b[y];
  }
}
int main() {
  int i;
  while (~scanf("%d%d", &n, &k)) {
    for (i = 0; i <= n; i++) {
      a[i].clear();
      b[i] = 0;
    }
    for (i = 1; i <= 2 * k; i++) {
      scanf("%d", &temp);
      b[temp] = 1;
    }
    for (i = 1; i < n; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      a[x].push_back(y);
      a[y].push_back(x);
    }
    ans = 0;
    dfs(1, 0);
    cout << ans << endl;
  }
}
