#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 20, inf = 1e9 + 7, M = 4e2 + 20;
int x, y, n, k, k2;
int arr_mark[N], dp[N];
long long ans;
bool arr0[N];
vector<int> gr[N];
void dfs(int a) {
  for (int u = 0; u < gr[a].size(); u++) {
    if (gr[a][u] != arr_mark[a]) {
      arr_mark[gr[a][u]] = a;
      dfs(gr[a][u]);
      ans += min(dp[gr[a][u]], k2 - dp[gr[a][u]]);
      dp[a] += dp[gr[a][u]];
    }
  }
  if (arr0[a] == 1) dp[a]++;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> k;
  k2 = 2 * k;
  for (int i = 0; i < k2; i++) {
    cin >> x;
    arr0[x] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  dfs(1);
  cout << ans;
}
