#include <bits/stdc++.h>
const int N = 2e5 + 50;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;
long long k, ans = 0;
bool univ[N];
vector<int> a[N];
long long dfs(int v, int p) {
  long long cnt = 0;
  for (int i = 0; i < a[v].size(); i++) {
    if (a[v][i] != p) {
      long long cur = dfs(a[v][i], v);
      cnt += cur;
      ans += min(cur, 2 * k - cur);
    }
  }
  return cnt + univ[v];
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n >> k;
  for (int i = 0; i < k * 2; i++) {
    int x;
    cin >> x;
    univ[x - 1] = true;
  }
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  dfs(0, -1);
  cout << ans;
  return 0;
}
