#include <bits/stdc++.h>
using namespace std;
int n, k;
int sub_sz[201010];
int pai[201010];
bool special[201010];
vector<int> g[201010];
void dfs(int x, int p) {
  pai[x] = p;
  sub_sz[x] = special[x];
  for (int i = 0; i < (int)g[x].size(); i++) {
    if (g[x][i] != p) {
      dfs(g[x][i], x);
      sub_sz[x] += sub_sz[g[x][i]];
    }
  }
  return;
}
int main() {
  scanf("%d %d", &n, &k);
  for (int x, i = 0; i < 2 * k; i++) {
    scanf("%d", &x);
    special[x] = true;
  }
  for (int i = 0; i < (n - 1); i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  long long ans = 0LL;
  for (int i = 1; i <= n; i++) ans += min(sub_sz[i], 2 * k - sub_sz[i]);
  printf("%lld\n", ans);
  return 0;
}
