#include <bits/stdc++.h>
using namespace std;
vector<int> tr[201010];
bool univ[201010];
int uncC[201010];
int par[201010];
int k;
void dfs(int x, int y) {
  par[x] = y;
  if (univ[x]) uncC[x] = 1;
  for (int z : tr[x]) {
    if (z != y) {
      dfs(z, x);
      uncC[x] += uncC[z];
    }
  }
}
long long dfs2(int x, int y) {
  long long ret = min(uncC[x], 2 * k - uncC[x]);
  for (int z : tr[x]) {
    if (z != y) ret += dfs2(z, x);
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n >> k;
  for (int i = 0; i < 2 * k; i++) {
    int u;
    cin >> u;
    univ[u] = true;
  }
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    tr[x].push_back(y);
    tr[y].push_back(x);
  }
  dfs(1, 0);
  cout << dfs2(1, 0) << "\n";
}
