#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200001];
vector<int> tree[200001];
unordered_map<int, int> wt[200001];
int lea = 0;
void dfs(int i, int j) {
  int w = 0;
  for (int x : tree[j]) {
    if (x == i) continue;
    if (wt[j][x] == -1) dfs(j, x);
    w += wt[j][x];
  }
  wt[i][j] = w + a[j];
  wt[j][i] = lea - w - a[j];
}
int main() {
  cin >> n >> k;
  lea = 2 * k;
  for (int i = 0; i < 2 * k; ++i) {
    int x;
    scanf("%d", &x);
    --x;
    a[x] = 1;
  }
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    --x;
    --y;
    tree[x].push_back(y);
    tree[y].push_back(x);
    wt[x][y] = -1;
    wt[y][x] = -1;
  }
  for (int i = 0; i < n; ++i)
    if (tree[i].size() == 1) {
      wt[tree[i][0]][i] = a[i];
      wt[i][tree[i][0]] = lea - a[i];
    }
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    for (int x : tree[i]) {
      if (wt[i][x] == -1) dfs(i, x);
      sum += min(wt[i][x], wt[x][i]);
    }
  }
  cout << sum / 2 << endl;
  return 0;
}
